求助如何将选项卡放到页面布局的底部

时间:2021-10-23 14:49:38
buttomtab.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:background="@drawable/maintab_toolbar_bg"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    >
    <TextView
        android:id="@+id/edit"
        android:text="1"
        android:gravity="center_horizontal"
        android:drawableTop="@drawable/tip_1"
        android:layout_alignParentLeft="true"
        android:layout_width="80dip"
        android:layout_height="wrap_content"        
        >
    </TextView>
    <TextView
        android:id="@+id/menu2"
        android:text="2"
        android:gravity="center_horizontal"
        android:drawableTop="@drawable/tip_2"
        android:layout_toRightOf="@id/edit"    
        android:layout_width="80dip"
        android:layout_height="wrap_content"    
        >
    </TextView>
    <TextView
        android:id="@+id/effect"
        android:text="3"
        android:gravity="center_horizontal"
        android:drawableTop="@drawable/tip_3"
        android:layout_toRightOf="@id/menu2"
        android:layout_width="80dip"
        android:layout_height="wrap_content"        
        >
    </TextView>
    <TextView
        android:id="@+id/menu3"
        android:text="4"
        android:gravity="center_horizontal"
        android:drawableTop="@drawable/tip_4"
        android:layout_toRightOf="@id/effect"
        android:layout_width="80dip"
        android:layout_height="wrap_content"        
        >
    </TextView>
</RelativeLayout>



----------------------------------------------------------------------

main.xml

<?xml version="1.0" encoding="utf-8"?> 

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
   android:orientation="vertical" 
   android:layout_width="fill_parent" 
   android:layout_height="fill_parent" 
   android:background="@layout/detail_style"
   > 
 
 <LinearLayout
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     
        android:paddingLeft="5dp"
        android:paddingRight="5dp"
        >

 <ImageView
        android:layout_width="wrap_content"
        android:layout_height="270dp"
        android:background="@drawable/sample_1" 
       /> 
 </LinearLayout>
  <LinearLayout
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
      android:paddingLeft="5dp"
    
     >
 <ImageView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/tip_1" 
       /> 
   <TextView 
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:text="@string/text_01"
      android:textSize="18dp"
      android:textColor="#000000"
      >
     </TextView>     
 
 </LinearLayout>
 
  <LinearLayout
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
      android:paddingLeft="5dp"
     >
 <ImageView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/tip_2" 
       /> 
   <TextView 
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
     android:text="@string/text_02"
      android:textSize="18dp"
      android:textColor="#000000"
 
       />
        
 </LinearLayout>
   
<LinearLayout
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
      android:paddingLeft="5dp"
    >
 <ImageView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/tip_3" 
       /> 
   <TextView 
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:text="@string/text_03"
      android:textSize="18dp"
      android:textColor="#000000" 
     />
  </LinearLayout>
  <RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    >
   <include layout="@layout/bottomtab" />
  </RelativeLayout>

</LinearLayout> 
  
将bottomtab 包含到main上之后,页面显示的却不在底部,求大神们相助!!!

6 个解决方案

#1


求助如何将选项卡放到页面布局的底部求助如何将选项卡放到页面布局的底部

#2


底部你用linealayout,不要用相对布局,试试的

#3


你要把那个菜单放在底部,那main最外面的布局应该是RelativeLayout
你设置的这个
<RelativeLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:layout_alignParentBottom="true"
  >
  <include layout="@layout/bottomtab" />
  </RelativeLayout>

这只是说include里面的东西相对于这个RelativeLayout是在底部,但RelativeLayout这个布局你并没有放在底部啊

#4


<RelativeLayout
            android:layout_width="fill_parent"
            android:layout_height="fill_parent" >

            <TabWidget
                android:id="@android:id/tabs"
                android:layout_width="match_parent"
                android:layout_height="47dp"
                android:layout_alignParentBottom="true"//这一行关键
                android:gravity="center"
                android:orientation="horizontal"
                android:tabStripEnabled="false" />
        </RelativeLayout>

#5


没看明白,求解释

引用 4 楼  的回复:
<RelativeLayout
            android:layout_width="fill_parent"
            android:layout_height="fill_parent" >

            <TabWidget
                android:id="@android:id/tabs"
          ……

#6


试过底部使用Linearlayout 依然不是想要的效果。

求助如何将选项卡放到页面布局的底部
引用 2 楼  的回复:
底部你用linealayout,不要用相对布局,试试的

#1


求助如何将选项卡放到页面布局的底部求助如何将选项卡放到页面布局的底部

#2


底部你用linealayout,不要用相对布局,试试的

#3


你要把那个菜单放在底部,那main最外面的布局应该是RelativeLayout
你设置的这个
<RelativeLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:layout_alignParentBottom="true"
  >
  <include layout="@layout/bottomtab" />
  </RelativeLayout>

这只是说include里面的东西相对于这个RelativeLayout是在底部,但RelativeLayout这个布局你并没有放在底部啊

#4


<RelativeLayout
            android:layout_width="fill_parent"
            android:layout_height="fill_parent" >

            <TabWidget
                android:id="@android:id/tabs"
                android:layout_width="match_parent"
                android:layout_height="47dp"
                android:layout_alignParentBottom="true"//这一行关键
                android:gravity="center"
                android:orientation="horizontal"
                android:tabStripEnabled="false" />
        </RelativeLayout>

#5


没看明白,求解释

引用 4 楼  的回复:
<RelativeLayout
            android:layout_width="fill_parent"
            android:layout_height="fill_parent" >

            <TabWidget
                android:id="@android:id/tabs"
          ……

#6


试过底部使用Linearlayout 依然不是想要的效果。

求助如何将选项卡放到页面布局的底部
引用 2 楼  的回复:
底部你用linealayout,不要用相对布局,试试的