0

我想创建一个简单的 TabActivity 并按照开发人员网站上的教程进行操作。实现工作正常,但布局困扰我。首先文字是白色,当背景是白色和灰色,当背景是灰色。我认为正常的行为会适得其反。但也缺少底部的这条白线,它应该连接不同的选项卡。

这是我的布局:

常规选项卡布局

    <TabHost
        android:id="@android:id/tabhost"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1">

        <LinearLayout
            android:orientation="vertical"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent">

            <TabWidget
                android:id="@android:id/tabs"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content" />

            <FrameLayout
                android:id="@android:id/tabcontent"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content" />

        </LinearLayout>

    </TabHost>

    <include layout="@layout/menu_back_only" />

</LinearLayout>

选择器

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">

    <item 
        android:drawable="@drawable/menu_home"
        android:state_selected="true" />

    <item 
        android:drawable="@drawable/menu_logout" />

</selector>

这就是它现在的样子:

错误的标签布局

4

1 回答 1

0

好的,似乎手机(HTC Legend)产生了错误。找到这个线程:单击并设置目标 SDK 版本确实可以解决问题。愚蠢的!

于 2011-01-04T14:48:31.127 回答