19

I have a menu item in my actionbar that shows only the text of the item - not the icon. And all is ok but just somehow the title of the item is going uppercase. can Can someone tell me how can I get it back to be as defined. Here is the menu xml i have:

 <?xml version="1.0" encoding="utf-8"?>
    <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" >

        <item
            android:id="@+id/action_download"
            android:orderInCategory="99"
            app:showAsAction="always|withText"
            android:title="Download"/>

    </menu>

and I get an Item displayed as DOWNLOAD instead of Download

Darko Petkovski
  • 3,892
  • 13
  • 53
  • 117

4 Answers4

49

This one helped me (I'm using AppCompat)

<item name="actionButtonStyle">@style/AppTheme.Widget.ActionButton</item>

<style name="AppTheme.Widget.ActionButton" parent="@style/Widget.AppCompat.ActionButton">
    <item name="textAllCaps">false</item>
</style>
MatrixDev
  • 1,432
  • 15
  • 20
7

You have override the theme and set your own style for the actionbar menu items

    <?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="YourTheme" parent="android:Theme.Holo">
        <item name="android:actionMenuTextAppearance">@style/LowerCaseMenuTextAppearance</item>
    </style>
    <style name="LowerCaseMenuTextAppearance" parent="android:TextAppearance.Holo.Widget.ActionBar.Menu">
        <item name="android:textAllCaps">false</item>
    </style>
</resources>
Thiyaga B
  • 971
  • 1
  • 9
  • 26
4

This post might be helpful How to style the menu items on an Android action bar

Basicly, what you will need to do is to apply a style to your menu item. In the style, add

android:capitalize="none"

I hope it helps.

Community
  • 1
  • 1
wolfaviators
  • 503
  • 1
  • 7
  • 21
1
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="android:textAllCaps">false</item>
</style>
Tiago Martins Peres
  • 14,289
  • 18
  • 86
  • 145
user3219477
  • 134
  • 3
  • 10
  • 1
    That'll affect ALL texts in your theme meaning all `Button`s and all `TextView`s, so this is definitely not a good approach. https://stackoverflow.com/a/32757893/882251 is the best approach. – Darwind Dec 27 '18 at 12:46