0
I am working with ActionBar menuitem action-help, it is visible always in     UPPERCASE latters but I needs to show in LOWERCASE latters.

There's been many questions on styling on action bars, but the ones I've found either are relating to styling the MenuItems Text, or have answers that don't work for me.

The question is really quite simple. I want to be able to change the text styling (even just colour or lowercase) of the menu items in the action bar.

I've read this: http://android-developers.blogspot.com/2011/04/customizing-action-bar.html?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+blogspot%2FhsDu+%28Android+Developers+Blog%29

And this question: Style an Action Bar in Android

From which I have put together a test application that I am using to try and get the menu items to change. It uses all the default values for an app created in the android studio android plugin, except for the following.

my v21\styles.xml look like
here is the code used for my AppTheme (make styles) used..


my Base Theme 

<style name="AppTheme" parent="@style/Theme.AppCompat.Light.NoActionBar">
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="android:colorPrimaryDark" tools:targetApi="lollipop">@color/colorPrimaryDark</item>
    <item name="android:colorAccent" tools:targetApi="lollipop">@color/colorAccent</item>
    <item name="android:colorBackground">@color/background_material_light</item>
    <item name="android:windowBackground">@color/windowBackground</item>

    <item name="android:actionBarStyle">@style/MyActionBar</item>
    <item name="android:actionMenuTextAppearance">@style/MyMenuTextAppearance</item>
</style>

<style name="MyMenuTextAppearance" parent="android:TextAppearance.Holo.Widget.ActionBar.Menu">
    <item name="android:textAllCaps">false</item>
</style>


<style name="MyActionBar" parent="@android:style/Widget.Holo.ActionBar">
    <item name="android:titleTextStyle">@style/MyActionBar.TitleTextStyle</item>
    <item name="android:actionMenuTextAppearance">@style/MyActionBar.MenuTextStyle</item>
</style>

<style name="MyActionBar.TitleTextStyle"
    parent="android:style/TextAppearance.Holo.Widget.ActionBar.Title">
    <item name="android:textColor">#F0F</item>
    <item name="android:textStyle">bold</item>
    <item name="android:textSize">24dip</item>
</style>

<style name="MyActionBar.MenuTextStyle"
    parent="android:style/TextAppearance.Holo.Widget.ActionBar.Menu">
    <item name="android:textColor">#F0F</item>
    <item name="android:textStyle">bold</item>
    <item name="android:textSize">24dip</item>

</style>

Dinesh
  • 482
  • 9
  • 20

1 Answers1

1

i found the correct answer for this question it will help for all also

Need to change in style i make a style of actionmenuTextApperance in parent for styling in Api21 but it will not work in Api 19 so for that i implement a code line i.e. false mystyle like below............

<resources>>
<style name="AppTheme.NoActionBar">
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
    <item name="android:windowDrawsSystemBarBackgrounds">true</item>
    <item name="android:statusBarColor">@android:color/transparent</item>

<--for api 21 and higher use below style-->

    <item name="actionMenuTextAppearance">@style/MyMenuTextAppearance</item>
</style>

<--below line needs to changes for api 19 and lower api-->

 <bool name="abc_config_actionMenuItemAllCaps">false</bool>

<style name="MyMenuTextAppearance" parent="TextAppearance.AppCompat.Widget.ActionBar.Menu">
    <item name="android:textAllCaps">false</item>
</style>

it will work deffinetly for all guys they struggling with this problem..
Dinesh
  • 482
  • 9
  • 20