changing title text color and size of menu android action bar -
i developing android application , in application using sherlock action bar. using menu action bar.
<menu xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@+id/card_menu" android:title="c123" android:showasaction="always"> <menu> <item android:id="@+id/c0" android:title="c0"/> <item android:id="@+id/c1" android:title="c1" /> <item android:id="@+id/c2" android:title="c2" /> </menu> </item> <item android:id="@+id/notification" android:title="notifications" android:showasaction="always" android:actionlayout="@layout/notification_icon" android:icon="@drawable/notification" /> <item android:id="@+id/filter" android:icon="@drawable/filter" android:title="filter" android:showasaction="always" /> </menu>
and display menu activity this..
inflater.inflate(r.menu.menu_type2, menu);
now want want alter title color of menu item (c123). able alter color of sub menu style not able alter of item text. tried in next way.
// alter sunbmenu text color not able alter color of item text(c123) <item name="android:dropdownlistviewstyle">@style/mypopupmenu</item> <item name="dropdownlistviewstyle">@style/mypopupmenu</item> <style name="mypopupmenu" parent="widget.sherlock.listpopupwindow"> <item name="android:textappearance">@style/textappearance.sherlock.widget.popupmenu</item> <item name="android:dropdownselector">@color/white</item> <item name="android:dividerheight">@dimen/divider_height</item> <item name="android:divider">@color/maroon</item> </style> <style name="textappearance.sherlock.widget.popupmenu" parent="android:style/textappearance.holo.widget.actionbar.menu"> <item name="android:textcolor">@color/white</item> </style>
i want modify menu item style alter color , size of text , background of that. how that. need help.. give thanks you..
you can alter color of menuitem
text using spannablestring
instead of string
.
@override public void oncreateoptionsmenu(menu menu, menuinflater inflater) { inflater.inflate(r.menu.your_menu, menu); int positionofmenuitem = 0; // or whatever... menuitem item = menu.getitem(positionofmenuitem); spannablestring s = new spannablestring("my reddish menuitem"); s.setspan(new foregroundcolorspan(color.red), 0, s.length(), 0); item.settitle(s); }
android android-actionbar submenu textcolor
No comments:
Post a Comment