我正在尝试更新我的记事本应用程序以使用 Material Design,即使在较旧的设备上也是如此。
到目前为止我做了什么:
- 将库 appcompat_v7 添加到我的项目中,以支持旧设备上的 Material Design
- 修改AndroidManifest中的主题,添加
android:theme="@style/Theme.NoteItTheme"
to <application ... ></application>
属性
-
在 /res/values/themes.xml 中创建主题:
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="Theme.NoteItTheme" parent="Theme.AppCompat.Light">
<!-- Here we setting appcompat’s actionBarStyle -->
<!-- <item name="actionBarStyle">@style/MyActionBarStyle</item> -->
<!-- ...and here we setting appcompat’s color theming attrs -->
<item name="colorPrimary">@color/primary</item>
<item name="colorPrimaryDark">@color/primary_dark</item>
<item name="android:textColorPrimary">@color/text</item>
<item name="colorAccent">@color/ui</item>
<!-- The rest of your attributes -->
</style>
问题:
正如您在这里可以更好地看到的:
当我展开操作栏的菜单时,文本颜色和背景颜色非常相似。
我以前没有遇到过这个问题,如何仅更改项目文本颜色?
<item name="android:textColorPrimary">yourColor</item>
上面的代码更改 API >= v21 的菜单操作项的文本颜色。
<item name="actionMenuTextColor">@android:color/holo_green_light</item>
以上是 API
一些教程:
更改工具栏的文本颜色和溢出图标颜色 http://www.murrayc.com/permalink/2014/10/28/android-changing-the-toolbars-text-color-and-overflow-icon-color/
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)