2

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

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

4

1 回答 1

5

Here you have everything about the tab pretty much. Works with Android 1.6 and above: http://joshclemm.com/blog/?p=136

You have to call setIndicator on your TabSpec and pass it a view instead of just text. Then you can customize that view using selectors etc.

于 2013-01-26T15:21:32.837 回答