0

我有两个使用选项卡切换的活动。我有一个问题,我的活动内容没有正确调整大小以考虑选项卡小部件的高度(因此活动内容显示在选项卡后面)。我在底部有标签。我试过玩标签布局等,但没有运气。

在设计布局(用于选项卡内容活动)时,有没有办法考虑 android 中的选项卡高度?我的猜测是,在将活动添加到选项卡主机后,我为活动设计布局的方式太高了。这在 iOS 上是可能的,但不知道如何在 android 上做到这一点。有任何想法吗?

    <?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
    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_alignParentBottom="true"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">
        </TabWidget>

        <FrameLayout
            android:id="@android:id/tabcontent"
            android:layout_above="@android:id/tabs"
            android:layout_width="match_parent"
            android:layout_height="match_parent">
        </FrameLayout>
    </RelativeLayout>

</TabHost>
4

1 回答 1

0

一个非常简单的解决方案是使用固定大小的标签,例如

    <TabWidget
        android:id="@android:id/tabs"
        android:layout_alignParentBottom="true"
        android:layout_width="match_parent"
        android:layout_height="64dp">
    </TabWidget>
于 2012-09-04T16:09:40.977 回答