How can I put FragmentTabHost Tabs at the bottom of the screen?

后端 未结 3 1463
余生分开走
余生分开走 2021-01-25 12:08

I have tried the following code. which aligns the framed layout above the tab widget but it still didn\'t work

 

        
相关标签:
3条回答
  • 2021-01-25 12:36

    The solution which finally worked for is the following:

      <LinearLayout
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical" >
    
            <FrameLayout
                android:id="@+id/realtabcontent"
                android:layout_width="match_parent"
                android:layout_height="0dip"
                android:layout_weight="1" />
    
            <android.support.v4.app.FragmentTabHost
                android:id="@android:id/tabhost"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" >
    
                <FrameLayout
                    android:id="@android:id/tabcontent"
                    android:layout_width="0dp"
                    android:layout_height="0dp"
                    android:layout_weight="0" />
            </android.support.v4.app.FragmentTabHost>
        </LinearLayout>
    
    0 讨论(0)
  • 2021-01-25 12:39

    Try this

    <LinearLayout
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        >
    
        <FrameLayout
            android:id="@android:id/tabcontent"
            android:layout_width="fill_parent"
           android:layout_height="wrap_content"
            android:padding="5dp"
            android:layout_weight="1"/>
        <TabWidget
            android:id="@android:id/tabs"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_weight="0"
            android:visibility="visible" 
            />
    
    </LinearLayout>
    

    0 讨论(0)
  • 2021-01-25 12:43

    Maybe like this:

    <android.support.v4.app.FragmentTabHost
        android:id="@android:id/tabhost"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >
    
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical" >
    
            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent" >
    
                <TabWidget
                    android:id="@android:id/tabs"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_alignParentBottom="true"
                    android:orientation="horizontal" />
            </RelativeLayout>
    
            <FrameLayout
                android:id="@+id/tabFrameLayout"
                android:layout_width="match_parent"
                android:layout_height="0dp" />
        </LinearLayout>
    
    </android.support.v4.app.FragmentTabHost>
    
    0 讨论(0)
提交回复
热议问题