【问题标题】:android: how to add style or background to tabhost and tabsandroid:如何为 tabhost 和 tabs 添加样式或背景
【发布时间】:2013-01-26 14:54:22
【问题描述】:

就像 android 联系人中的标签一样,我想添加样式(或者可能是背景或我不知道的东西),请问如何?

<?xml version="1.0" encoding="utf-8"?>
<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">
    <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="fill_parent"/>
    </LinearLayout>
</TabHost>

你能告诉我在哪里可以找到好的背景或标签,因为我不擅长设计:)

【问题讨论】:

    标签: android android-layout android-tabs android-style-tabhost


    【解决方案1】:

    在这里,您几乎可以找到有关选项卡的所有内容。适用于 Android 1.6 及更高版本:http://joshclemm.com/blog/?p=136

    您必须在 TabSpec 上调用 setIndicator 并将其传递给视图,而不仅仅是文本。然后您可以使用选择器等自定义该视图。

    【讨论】:

    • 我知道,我问的是 tabhost 的样式,而不是每个标签
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-11-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多