简体   繁体   中英

Why does my TabWidget not look, like it is supposed to?

I want to create a simple TabActivity and followed the tutorial on the developer site. The implementation works fine, but the layout bothers me. First of all the text is white, when the background is white and gray, when the background is gray. I thought the regular behavior would be the opposite. But also this one white line on the bottom, that should connect the different tabs is missing.

Here are my layouts:

General Tab layout

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

Selectos

<?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>

And this is, how it looks right now:

选项卡布局错误

Ok, it seems, as if the mobile (HTC Legend) produces the error. Found this thread: Click and setting the target SDK version really does the trick. Stupid!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM