Andoid 菜单项没办法小写(自动大写)

20140621,终于解决了.

参考地址:

http://stackoverflow.com/questions/17044790/android-actionbar-menuitem-lowercase


原文问题:

I want to make MenuItem title in the ActionBar to LowerCase.

我想要标题栏中的菜单显示小写字符.

my menu.xml

   android:id="@+id/register"
    android:title="Register"
    android:showAsAction="ifRoom|withText"/>

   android:id="@+id/unregister"
    android:title="Unregister"
    android:showAsAction="ifRoom|withText"/>

On the ActionBar it sees "REGISTER" and "UNREGISTER", but I want that it sees as "Register" and "Unregister".

我想要显示 "Register",但实际上显示的是"REGISTER",


Is it possible to make first letter upper and next letters lower at MenuItem? And how I can do that?

有办法让菜单显示小写么?


解决方法:

Solution for native ActionBar implementation:

xml version="1.0" encoding="utf-8"?>

     name="MyTheme" parent="android:Theme.Holo">
        <item name="android:actionMenuTextAppearance">@style/MyMenuTextAppearanceitem>
    
     name="MyMenuTextAppearance" parent="android:TextAppearance.Holo.Widget.ActionBar.Menu">
        <item name="android:textAllCaps">falseitem>
    

If you are using ActionBarSherlock there are two different approaches:

1) Create boolean resource abs__config_actionMenuItemAllCaps and set it to false:

xml version="1.0" encoding="utf-8"?>

     name="abs__config_actionMenuItemAllCaps">false

2) Or create theme with overriden actionMenuTextAppearance and use it in AndroidManifest.xml:

xml version="1.0" encoding="utf-8"?>

     name="MyTheme" parent="Theme.Sherlock">
        <item name="actionMenuTextAppearance">@style/MyMenuTextAppearanceitem>
        <item name="android:actionMenuTextAppearance">@style/MyMenuTextAppearanceitem>
    
     name="MyMenuTextAppearance" parent="TextAppearance.Sherlock.Widget.ActionBar.Menu">
        <item name="android:textAllCaps">falseitem>
    

翻译/备注:

这个问题我查了两天,大概这个方法:

1.程序使用自定义主题

 


2.设置自定义主题的ActionBar的菜单不自动大写