Search code examples
android-actionbarandroidandroid-tabsandroid-styles

Change ActionBar tabs color


I am using the appcompat support library and I want to change the color of the action bar tabs. I found these instructions in which the customize tab indicator section suggests creating a file res/drawable/actionbar_tab_indicator.xml declaring a specific background image for several different states of an action bar tab.

actionbar_tab_indicator.xml looks like :

<!-- STATES WHEN BUTTON IS NOT PRESSED -->

    <!-- Non focused states -->
    <item android:state_focused="false" android:state_selected="false"
          android:state_pressed="false"
          android:drawable="@drawable/tab_unselected" />

...

The @drawable/* images are nine patches. However, i do not want to get involved in creating nine-patches images. Is there another way to change the actionbar tab's color?


Solution

  • I wrote an answer to that question 1 year ago.

    You can find in here: Change Color TabSelector on v4 ViewPager