android - Customize ActionBar tabs -
android - Customize ActionBar tabs -
the traditional way implement actionbar tabs has been deprecated. have implemented tabs guide github tabs.
however have problem styling tabs guide. seems can style tabs through java code this:
slidingtablayout .setcustomtabcolorizer(new slidingtablayout.tabcolorizer() { @override public int getindicatorcolor(int position) { homecoming color.red; } });
this alter color of indicator, want alter background of tabs in both selected, deselected , pressed states. tradional way alter theme , create xml file this:
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <!-- states when button not pressed --> <!-- non focused states --> <item android:state_focused="false" android:state_selected="false" android:state_pressed="false" android:drawable="@drawable/tab_unselected" /> <item android:state_focused="false" android:state_selected="true" android:state_pressed="false" android:drawable="@drawable/tab_selected" /> <!-- focused states (such when focused d-pad or mouse hover) --> <item android:state_focused="true" android:state_selected="false" android:state_pressed="false" android:drawable="@drawable/tab_unselected_focused" /> <item android:state_focused="true" android:state_selected="true" android:state_pressed="false" android:drawable="@drawable/tab_selected_focused" /> <!-- states when button pressed --> <!-- non focused states --> <item android:state_focused="false" android:state_selected="false" android:state_pressed="true" android:drawable="@drawable/tab_unselected_pressed" /> <item android:state_focused="false" android:state_selected="true" android:state_pressed="true" android:drawable="@drawable/tab_selected_pressed" /> <!-- focused states (such when focused d-pad or mouse hover) --> <item android:state_focused="true" android:state_selected="false" android:state_pressed="true" android:drawable="@drawable/tab_unselected_pressed" /> <item android:state_focused="true" android:state_selected="true" android:state_pressed="true" android:drawable="@drawable/tab_selected_pressed" /> </selector>
how can same new way of doing tabs without having install 3rd party librarys github?
android tabs
Comments
Post a Comment