
[英]Android Action Bar: Changing the color of Action Buttons and title to the center
[英]Android Action Bar: Changing the color of Action Buttons
我有一个带有操作栏的应用程序,如下所示:
我希望菜单操作按钮“Home”和“Logout”的文本也是白色的。 如何更改文字颜色?
如果您想查看任何代码,请告诉我们。
谢谢!
正如我android:actionMenuTextColor
,这是一个名为android:actionMenuTextColor
的简单属性。
要正确使用它,您应该创建自己的样式,如下所示:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="myTheme" parent="@android:style/Theme.Holo.Light">
<item name="android:actionMenuTextColor">@color/actionBarText</item>
</style>
<style name="myTheme.ActionBar" parent="@android:style/Widget.Holo.Light.ActionBar">
<item name="android:titleTextStyle">@style/myTheme.ActionBar.Text</item>
</style>
<style name="myTheme.ActionBar.Text" parent="@android:style/TextAppearance">
<item name="android:textColor">@color/actionBarText</item>
</style>
</resources>
然后将@ color / actionBarText设置为您选择的颜色。 您还可以在此处定义其他值,例如背景颜色。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.