i want change default blue color of tabhost red.
<style name="apptheme" parent="android:theme.light.notitlebar"> <item name="android:tabwidgetstyle">@drawable/tab_indicator_holo</item> </style>
tab_indicator_holo.xml
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <!-- non focused states --> <item android:state_focused="false" android:state_selected="false" android:state_pressed="false" android:drawable="@drawable/tab_unselected_holo" /> <item android:state_focused="false" android:state_selected="true" android:state_pressed="false" android:drawable="@drawable/tab_selected_holo" /> <!-- focused states --> <item android:state_focused="true" android:state_selected="false" android:state_pressed="false" android:drawable="@drawable/tab_unselected_focused_holo" /> <item android:state_focused="true" android:state_selected="true" android:state_pressed="false" android:drawable="@drawable/tab_selected_focused_holo" /> <!-- pressed --> <!-- non focused states --> <item android:state_focused="false" android:state_selected="false" android:state_pressed="true" android:drawable="@drawable/tab_unselected_pressed_holo" /> <item android:state_focused="false" android:state_selected="true" android:state_pressed="true" android:drawable="@drawable/tab_selected_pressed_holo" /> <!-- focused states --> <item android:state_focused="true" android:state_selected="false" android:state_pressed="true" android:drawable="@drawable/tab_unselected_pressed_holo" /> <item android:state_focused="true" android:state_selected="true" android:state_pressed="true" android:drawable="@drawable/tab_selected_pressed_holo" /> </selector>
but tab style not applied tabhost. default blue color not changed red.
i getting this
any ideas or suggestions please.
you might have found answer, may face same problem, here have done.
go custom holo theme , set tabwedget yes , choose preferred color.
download zip, copy on project.
add tabadapter view created inflating tab_indicator_holo.
view mindicator = inflater.inflate(r.layout.tab_indicator_holo, mtabhost.gettabwidget(), false); textview title1 = (textview) mindicator.findviewbyid(android.r.id.title); title1.settext("tab1"); mtabsadapter.addtab(mtabhost.newtabspec("tab1").setindicator( mindicator), fragment1.class, null); view mindicator2 = inflater.inflate(r.layout.tab_indicator_holo, mtabhost.gettabwidget(), false); textview title2 = (textview) mindicator2.findviewbyid(android.r.id.title); title2.settext("tab2"); mtabsadapter.addtab(mtabhost.newtabspec("tab2").setindicator(mindicator2), fragment2.class, null);
Comments
Post a Comment