【问题标题】:android tabhost custom colorandroid tabhost自定义颜色
【发布时间】:2010-06-29 06:46:54
【问题描述】:

我正在将 Tabhost 用于项目选项卡。我将选项卡的颜色更改为蓝色,但选项卡下方有 2px 线。谁能帮我把白色改成蓝色。 http://img816.imageshack.us/img816/228/device.png

【问题讨论】:

  • 我很好奇你是如何获得这个职位的,你能分享你的代码吗?

标签: android android-style-tabhost


【解决方案1】:

您的屏幕设计可能存在与 TabHost 无关的问题。您是否检查了屏幕/小部件/布局填充?

以下代码 sn-p 完全符合您的要求。添加另一个选项卡就可以了。

<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@android:id/tabhost"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <RelativeLayout
        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" 
            android:layout_alignParentBottom="true"/>
        <FrameLayout
            android:id="@android:id/tabcontent"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_above="@android:id/tabs">

            <include android:id="@+id/tab1" layout="@layout/tab1" />

            <include android:id="@+id/tab2" layout="@layout/tab2" />

            <include android:id="@+id/tab3" layout="@layout/tab3" />
        </FrameLayout>
    </RelativeLayout>
</TabHost>

【讨论】:

  • 您好,填充问题仅存在于 sdk 1.5 中。当我将编码更改为 1.6 时,白色边框自动消失。
【解决方案2】:

Android: Tabs at the BOTTOM

我不知道是否仍然没有界面可以自定义或禁用选项卡下方的栏,但也有兴趣回答。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多