[英]Android appbar background color and (back button and more menu item icon color) conflict
I am using the below code to define my application theme. 我正在使用以下代码定义我的应用程序主题。 But when I tries to add back button and menu items in appbar, icon of these button and appbar background are same.
但是当我尝试在appbar中添加后退按钮和菜单项时,这些按钮的图标和appbar背景相同。 As a result these two icons remain invisible.
结果,这两个图标仍然不可见。 But when I click on them it works fine.
但是,当我单击它们时,效果很好。
What I am missing? 我缺少什么? I think I have massed up with some very basic concept.
我想我已经提出了一些非常基本的概念。
<style name="MaterialThemeActionBar" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="windowActionBar">true</item>
<item name="windowNoTitle">false</item>
<item name="colorPrimary">@color/colorAccent</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/windowBackground</item>
<item name="android:windowBackground">@color/windowBackground</item>
<item name="android:textColor">#99FFFFFF</item>
<item name="toolbarStyle">@style/custom_toolbar</item>
<item name="android:itemBackground">@color/windowBackground</item>
</style>
<style name="custom_toolbar" parent="@style/Widget.AppCompat.Toolbar">
<item name="titleTextColor">@color/windowBackground</item>
</style>
<color name="colorPrimary">#FFFFFF</color>
<color name="colorPrimaryDark">#7b7f89</color>
<color name="colorAccent">#FFFFFF</color>
<color name="windowBackground">#A72C32</color>
here 1. back button(white color!) 2. menu button icon (also white color) Note: I can change the color of back button from java class. 此处1.后退按钮(白色!)2.菜单按钮图标(也为白色)注意:我可以从java类中更改后退按钮的颜色。 But I think it is not the right way to do this.
但是我认为这不是正确的方法。
Thanks 谢谢
just change 只是改变
<style name="custom_toolbar" parent="@style/Widget.AppCompat.Toolbar">
<item name="titleTextColor">@color/windowBackground</item>
to this 对此
<style name="custom_toolbar" parent="@style/Widget.AppCompat.Toolbar">
<item name="titleTextColor">@color/colorPrimaryDark</item>
actually you are calling @color/windowBackground in both view for toolbar background and backbutton color 实际上,您在工具栏背景和后退按钮颜色的两个视图中都调用@ color / windowBackground
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.