Search code examples
androidandroid-actionbarandroid-viewandroid-toolbarmenuitem

Decapitalize MenuItem text in APIs lower 23


I want to decapitalize the menu item text in kitkat and lollipop devices but fortunately its working on marshmallow and nougat. I found many solution regarding this problem but everything works in nougat and marshmallow but not in lollipop and below devices here is my code

 <style name="AppTheme" parent="AppTheme.Base"/>

<style name="AppTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
    <item name="windowNoTitle">true</item>
    <item name="windowActionBar">false</item>
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</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>

Same Code in marshmallow looks like this: Marshmallow menuitem

But in lollipop and kitkat it looks this: Lollipop menuitem

Please help me to get a solution.


Solution

  • Instead of:

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

    Do:

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

    Update

    For pre-lollipop devices add this to your dimens.xml:

    <bool name="abc_config_actionMenuItemAllCaps" tools:override="true">false</bool>