ActionBar tab background with xml
===

Is it possibile to create a Holo-like ActionBar tab background **only** with xml drawables? If yes, how? If no, what's the limitation?

![enter image description here][1]

Browsing the Android source code I found that the tab background is defined with a selector drawable in [tab_indicator_holo.xml][2]:

    <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>

And then using 9 patch drawables for each state, such as [tab_selected_holo.9.png][3].

I was wondering if those 9 patch drawables could be replaced with layer list drawables, shape drawables or a combination, thus saving the need to create various PNG files (6 per density by my count).

I noticed that [ActionBarSherlock][4] also uses 9 patch drawables, so it's highly likely this is the only way to do it.


  [1]: http://i.stack.imgur.com/VimUQ.png
  [2]: https://github.com/android/platform_frameworks_base/blob/master/core/res/res/drawable/tab_indicator_holo.xml
  [3]: https://github.com/android/platform_frameworks_base/blob/master/core/res/res/drawable-xhdpi/tab_selected_holo.9.png
  [4]: http://actionbarsherlock.com/