android - ActionBar list navigation: different text color in header and pop up menu -
i have navigation list in action bar has dark background. pop menu however, has white background.
so want achieve is, item text color inside of action bar white whereas items text color in menu pop black.
this 2 examples got far:
this how should like:
does know solution?
this code list navigation:
arrayadapter<string> adapter = new arrayadapter<string>(this, android.r.layout.simple_dropdown_item_1line, new string[] { "item 1", "item 2" }); getsupportactionbar().setnavigationmode(actionbar.navigation_mode_list); getsupportactionbar().setlistnavigationcallbacks(adapter, new actionbar.onnavigationlistener() { @override public boolean onnavigationitemselected(int itemposition, long itemid) { return true; } }); getsupportactionbar().setselectednavigationitem(0)
these collection of styles worked with.
<style name="customtheme" parent="@style/theme.customized"> <item name="actionbarstyle">@style/widget.styled.actionbar</item> <item name="android:actionbarstyle">@style/widget.styled.actionbar</item> <item name="actiondropdownstyle">@style/customsherlockdropdownnav</item> <item name="android:actiondropdownstyle">@style/customsherlockdropdownnav</item> <!-- didn't work: http://stackoverflow.com/questions/12395381/android-actionbar-navigation-spinner-text-color <item name="android:spinnerdropdownitemstyle">@style/custom.widget.dropdownitem.spinner</item> <item name="spinnerdropdownitemstyle">@style/custom.widget.dropdownitem.spinner</item> --> <!-- didn't work: http://stackoverflow.com/questions/11479186/styling-actionbar-dropdown-menu <item name="android:actionbarwidgettheme">@style/custom.actionbarwidgettheme</item> <item name="actionbarwidgettheme">@style/custom.actionbarwidgettheme</item> --> <!-- didn't work: http://android-developers.blogspot.de/2011/04/customizing-action-bar.html <item name="android:dropdownlistviewstyle">@style/customdropdownlistview</item> <item name="dropdownlistviewstyle">@style/customdropdownlistview</item> --> .... </style> <style name="custom.actionbarwidgettheme" parent="@style/theme.sherlock.light.darkactionbar"> <item name="android:spinnerdropdownitemstyle">@style/custom.widget.dropdownitem.spinner</item> </style> <style name="custom.widget.dropdownitem.spinner" parent="@style/widget.sherlock.dropdownitem.spinner"> <item name="android:textappearance">@style/custom.textappearance.widget.dropdownitem</item> </style> <style name="custom.textappearance.widget.dropdownitem" parent="@style/textappearance.sherlock.widget.dropdownitem"> <item name="android:textcolor">#00a000</item> </style> <style name="customdropdownlistview" parent="android:style/widget.holo.listview.dropdown"> <item name="android:textcolor">#00a000</item> <item name="android:textsize">8dip</item> </style> <style name="customsherlockdropdownnav" parent="@style/widget.sherlock.light.spinner.dropdown.actionbar"> <item name="android:popupbackground">@drawable/menu_dropdown_panel_customtab</item> <item name="android:background">@drawable/spinner_background_ab_customtab</item> </style>
however nothing didn't work.
the problem using same resource android.r.layout.simple_dropdown_item_1line
spinner item , spinner dropdown item.
use r.layout.sherlock_spinner_item
, r.layout.sherlock_spinner_dropdown_item
instead.
arrayadapter<string> adapter = new arrayadapter<string>(this, r.layout.sherlock_spinner_item, new string[] { "item 1", "item 2" }); adapter.setdropdownviewresource(r.layout.sherlock_spinner_dropdown_item);
this way, styles widget.sherlock.textview.spinneritem
work.
Comments
Post a Comment