我怎样才能把FragmentTabHost标签在屏幕的底部?屏幕、标签、FragmentTabHost

2023-09-08 10:17:00 作者:╱╳灬英ゞ

我曾尝试以下code。它对准上面的标签插件的框架布局,但它仍然没有奏效

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

 <android.support.v4.app.FragmentTabHost
        android:id="@android:id/tabhost"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >

        <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" />

            <FrameLayout
                android:id="@+id/tabFrameLayout"
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:layout_alignParentTop="true"
                android:layout_above="@android:id/tabs"
             />
        </RelativeLayout>
    </android.support.v4.app.FragmentTabHost>

修改 我使用FragmentTabHost。也许这可能是为什么它不改变立场

edit i am using FragmentTabHost. maybe that could be why it's not changing position

推荐答案

这终于研究出了解决方法如下:

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>