我想使菜单项冠军中的动作条为小写。
I want to make MenuItem title in the ActionBar to LowerCase.
我menu.xml文件
my menu.xml
<item android:id="@+id/register"
android:title="Register"
android:showAsAction="ifRoom|withText"/>
<item 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".
时有可能使在菜单项第一个字母上,下一个字母下? 我怎么能做到这一点?
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"?>
<resources>
<style name="MyTheme" parent="android:Theme.Holo">
<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>
</resources>
如果您使用的是ActionBarSherlock有两种不同的方法:
If you are using ActionBarSherlock there are two different approaches:
1)创建布尔资源 abs__config_actionMenuItemAllCaps
键,将其设置为假
:
1) Create boolean resource abs__config_actionMenuItemAllCaps
and set it to false
:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<bool name="abs__config_actionMenuItemAllCaps">false</bool>
</resources>
2),或创建主题与被覆盖的 actionMenuTextAppearance
,并用它在的AndroidManifest.xml
:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="MyTheme" parent="Theme.Sherlock">
<item name="actionMenuTextAppearance">@style/MyMenuTextAppearance</item>
<item name="android:actionMenuTextAppearance">@style/MyMenuTextAppearance</item>
</style>
<style name="MyMenuTextAppearance" parent="TextAppearance.Sherlock.Widget.ActionBar.Menu">
<item name="android:textAllCaps">false</item>
</style>
</resources>
请注意:有强制菜单项是在pre-ICS(https://github.com/JakeWharton/ActionBarSherlock/issues/969).我此刻提交补丁,但不合并现在你可以用我的叉:https://github.com/alexander-mironov/ActionBarSherlock/tree/dev,我会更新这个答案时,我的code在主存储库合并。
PLEASE NOTE: there is bug in ActionBarSherlock that forces MenuItem to be upper case on pre-ICS (https://github.com/JakeWharton/ActionBarSherlock/issues/969). I've submitted patch but it is not merged at the moment. For now you can use my fork: https://github.com/alexander-mironov/ActionBarSherlock/tree/dev, I will update this answer when my code is merged in the main repository.
更新:我的补丁已经被合并到主ActionBarSherlock库
UPDATE: my fix has been merged into main ActionBarSherlock repository.
上一篇:indeterminateProgressBar在动作条造型 - 填充问题造型、动作、问题、indeterminateProgressBar
下一篇:安卓4.2.1,WebView功能和JavaScript界面突破界面、功能、WebView、JavaScript