I am struggling with the design of ActionBar. My application has an ActionBar with three tabs. I am trying to make the selected tab have a background color, and unselected tabs display a different color. I follow this link: Custom action bar . But all TABs display the selected color.
My styles.xml file looks like this:
<style name="MyActionBarTabStyle" parent="android:style/Widget.Holo.Light.ActionBar.TabBar"> <item name="android:background">@drawable/tab_background</item> <item name="android:paddingLeft">32dp</item> <item name="android:paddingRight">32dp</item> </style> <style name="MyActionBarTabBarStyle" parent="android:style/Widget.Holo.Light.ActionBar.TabBar"> <item name="android:background">@drawable/red</item> </style> <style name="AppTheme.Light" parent="@android:style/Theme.Holo.Light"> <item name="android:actionBarStyle">@style/ActionBar.Light</item> <item name="android:actionBarTabStyle">@style/MyActionBarTabStyle</item> <item name="android:actionBarTabBarStyle">@style/MyActionBarTabBarStyle</item> </style>
tab_background - only 9 patches. I'm also not sure if I inherit the action bar tab from the correct parent ( parent="android:style/Widget.Holo.Light.ActionBar.TabBar ). I looked through the links and it is very difficult to understand the hierarchy of styles.
Why are my tabs not showing or not? Thanks in advance for your help.
android android-actionbar android-styles android-tabs
CocoNess Nov 08 2018-12-12T00: 00Z
source share