Android tabs textcolor selector ignores state_pressed -
Android tabs textcolor selector ignores state_pressed -
i have created own android theme alter of actionbar tabs. problem textcolor selector seems ignore state_pressed attribute, color of tab text same, if tab pressed. there no problem other states, illustration state_selected correctly recognized , selected tab has text color, different unselected tabs text color. what more, have created selector tabs background , works fine state_pressed (if tab pressed, it's backround color changed).
there pieces of code:
styles.xml:
<style name="theme.mytheme" parent="android:theme.holo.light.darkactionbar"> <item name="android:actionbartabstyle">@style/theme.mytheme.tabstyle</item> <item name="android:actionbartabtextstyle">@style/theme.mytheme.tabtextstyle</item> </style> ... <style name="theme.mytheme.tabstyle" parent="@android:style/widget.holo.light.actionbar.tabview"> <item name="android:background">@drawable/background_selector</item> </style> <style name="theme.mytheme.tabtextstyle" parent="@android:style/widget.holo.light.actionbar.tabtext"> <item name="android:textcolor">@color/textcolor_selector</item> </style>
background_selector.xml:
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_selected="false" android:state_pressed="false"> <shape> <solid android:color="#00ff00"/> </shape> </item> <item android:state_selected="false" android:state_pressed="true"> <shape> <solid android:color="#0000ff"/> </shape> </item> <item android:state_selected="true" android:state_pressed="false"> <shape> <solid android:color="#ff0000"/> </shape> </item> <item android:state_selected="true" android:state_pressed="true"> <shape> <solid android:color="#ffff00"/> </shape> </item> </selector>
textcolor_selector.xml
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_selected="true" android:state_pressed="false" android:color="#ff0000"/> <item android:state_selected="true" android:state_pressed="true" android:color="#0000ff"/> <item android:state_selected="false" android:state_pressed="false" android:color="#ffff00"/> <item android:state_selected="false" android:state_pressed="true" android:color="#00ff00"/> </selector>
i have tried without success - state_pressed attribute seems ignored, in textcolor_selector. please, help me understand , solve problem.
review customize text color section of actionbar styling documentation - mentions note: custom style applied titletextstyle should utilize textappearance.holo.widget.actionbar.title parent style.
- perhaps alter there might help right problem.
another place here under example theme
section - shows illustration of android:actionbartabtextstyle
might help things sorted you.
android android-styles textcolor
Comments
Post a Comment