Wie kann ich das tun? ist es möglich?Android tabview ändern die Textfarbe nicht backgroundcolor
.
tabhost.getTabWidget() getChildAt (i). setTextColor oder etwas anderes ..?
Wie kann ich das tun? ist es möglich?Android tabview ändern die Textfarbe nicht backgroundcolor
.
tabhost.getTabWidget() getChildAt (i). setTextColor oder etwas anderes ..?
Ich denke, Sie könnten TabHost.TabSpec.setIndicator(android.view.View view) eine TextView
übergeben konfiguriert (eingefärbt) nach Ihren Bedürfnissen.
Allerdings habe ich Ihren Beitrag noch einmal gelesen - wahrscheinlich meinen Sie, wie man die Farbe des Tab-Inhalts ändert, während ich über Tab-Label spreche ... Wenn dies der Fall ist, bitte ignorieren Sie diese Antwort.
UPDATE:
Es ist sehr bequem in Ihrem Layout xml zu tun:
<?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">
<TextView
android:id="@+id/textview1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="this is a tab - RED"
android:textColor="#FF0000" />
<TextView
android:id="@+id/textview2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="this is another tab - GREEN"
android:textColor="#00FF00" />
<TextView
android:id="@+id/textview3"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="this is a third tab - BLUE"
android:textColor="#0000FF" />
</FrameLayout>
</LinearLayout>
</TabHost>
ColorStateLists Versuchen. Viel Glück.
die Textfarbe von Tabs zu wechseln, müssen Sie die Ansicht dh Textview erhalten, die als Titel des Tabs eingestellt ist, und Sie können es wie folgt ändern:
TabHost tabhost = getTabHost();
for(int i=0;i<tabhost.getTabWidget().getChildCount();i++)
{
TextView tv = (TextView) tabhost.getTabWidget().getChildAt(i).findViewById(android.R.id.title);
tv.setTextColor(.....);
}
hoffe, das hilft ....