开发者

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

开发者 https://www.devze.com 2023-01-31 18:09 出处:网络
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

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:

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


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!

0

精彩评论

暂无评论...
验证码 换一张
取 消