您的位置:首页 > 移动开发 > Android开发

Android 中 TabHost 的 TabWidget 显示问题

2017-01-02 01:33 357 查看
当布局文件是这样的时候:
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"

    xmlns:tools="http://schemas.android.com/tools"

    android:id="@android:id/tabhost"

    android:layout_width="fill_parent"

    android:layout_height="fill_parent"

    tools:context="com.smtsokt.activity.MainActivity" >

    <LinearLayout

        android:layout_width="fill_parent"

        android:layout_height="fill_parent"

        android:orientation="vertical" >

        <FrameLayout

            android:id="@android:id/tabcontent"

            android:layout_width="fill_parent"

            android:layout_height="0dp"

            android:layout_weight="11" >

        </FrameLayout>

        <TabWidget

            android:id="@android:id/tabs"

            android:layout_width="match_parent"

            android:layout_height="0dp"

            android:layout_weight="1"

            android:orientation="horizontal" >

        </TabWidget>

    </LinearLayout>

</TabHost>


显示为:


当更改为:
       <TabWidget

            android:id="@android:id/tabs"

            android:layout_width="wrap_content"

            android:layout_height="0dp"

            android:layout_weight="1"

            android:orientation="horizontal" >

        </TabWidget>


显示为:


怎么让几个选项卡铺满整行?
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: