【发布时间】:2014-10-18 18:30:17
【问题描述】:
我最近下载了 Android Lollipop SDK,并更新了所有依赖项、修复了构建路径并顺利导入了以下支持库:
android-support-v7-appcompat android-support-v7-gridlayout android-support-v7-mediarouter android-support-v7-调色板
我的应用使用蓝牙低功耗,所以我的minSDK版本是18,targetSDK是最新的; 21.
当我尝试使用以下 xml 应用材料主题(使用 appcompat-v7)时,我的问题出现了:
<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<item name="colorPrimary">@color/material_blue_500</item>
<item name="colorPrimaryDark">@color/material_blue_700</item>
<item name="colorAccent">@color/material_green_A200</item>
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
<!-- <item name="android:actionBarStyle">@style/AppBaseActionBar</item> -->
</style>
<!-- the theme applied to the application or activity -->
当我尝试运行它时,出现以下错误:
错误:未找到与给定名称匹配的资源(在“colorAccent”处,值为“@color/material_green_A200”)
经过一番谷歌搜索后,我发现了 3 天前更新的这个 github 存储库:gist.github.com/eyecatchup/b5e564cfe11619cc3999
在那里,大多数材料设计颜色都已定义,所以我只是将其复制到我的主题的 color.xml 中。
尽管该行在 xml 中,但我仍然收到以下错误:
错误:未找到与给定名称匹配的资源(位于“bright_foreground_material_light”,值为“@color/black”)。
无论如何,我删除了该特定行并成功在手机上安装了该应用程序。但是,主题仍然是 Holo 而不是 Material。
谁能告诉我我做错了什么? docs 非常清楚地表明我可以在低于 5.0 的版本中使用 Material 主题,并且我按照 here 列出的关于保持兼容性的说明进行操作。
非常感谢您的帮助。
【问题讨论】:
-
按名称“material_green_A200”在资源中添加颜色...
标签: android android-5.0-lollipop android-support-library