相关疑难解决方法(0)

如何更改android中标签指示文字的颜色?

如何更改选项卡文本指示器的颜色?我可以使用选择标签更改图标参考示例.但不能文字颜色.怎么样?

tabs android tabwidget

24
推荐指数
4
解决办法
7万
查看次数

Android:以编程方式更改选项卡文本颜色

我有一个像这样的TabHost:

<?xml version="1.0" encoding="utf-8"?>
 <TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@android:id/tabhost"
android:background="@drawable/tabs_bg">

<LinearLayout 
    android:id="@+id/LinearLayout01"
    android:orientation="vertical" 
    android:layout_height="fill_parent"
    android:layout_width="fill_parent">
    <TabWidget 
        android:id="@android:id/tabs"
        android:layout_height="wrap_content" 
        android:layout_width="fill_parent"
        android:layout_marginBottom="5dip">
    </TabWidget>
    <FrameLayout 
        android:id="@android:id/tabcontent"
        android:layout_height="fill_parent" 
        android:layout_width="fill_parent">
    </FrameLayout>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

我正在以编程方式向此TabHost添加标签,如下所示:

tabHost = (TabHost)findViewById(android.R.id.tabhost);
    tabHost.setOnTabChangedListener(this);

    /* tid1 is firstTabSpec Id. Its used to access outside. */
    TabSpec firstTabSpec = tabHost.newTabSpec("tid1");
    TabSpec secondTabSpec = tabHost.newTabSpec("tid2");
    TabSpec ThirdTabSpec = tabHost.newTabSpec("tid3");

    /* TabSpec setIndicator() is used to set name for the tab. */
    /* TabSpec setContent() is used to set content for a particular tab. */ …
Run Code Online (Sandbox Code Playgroud)

android android-widget

16
推荐指数
3
解决办法
5万
查看次数

标签 统计

android ×2

android-widget ×1

tabs ×1

tabwidget ×1