简体   繁体   English

在小写字母中看不到ActionBar菜单项

[英]ActionBar MenuItems not visible in LowerCase Latters

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. 关于动作栏样式的问题很多,但是我发现的问题要么与MenuItems文本的样式有关,要么有不适合我的答案。

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 我已阅读以下内容: 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 这个问题:在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. 除以下内容外,它使用在android studio android插件中创建的应用程序使用所有默认值。

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>

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 ie false mystyle like below............ 需要更改样式,我在Api21中为父样式创建了一个actionmenuTextApperance样式,但在Api 19中将不起作用,因此我实现了代码行,即如下所示的假mystyle ............

<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--> <-对于api 21及以下样式的更高使用->

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

<--below line needs to changes for api 19 and lower api--> <-api 19和更低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..

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM