Kur*_*s92 5 android color-palette android-support-library material-design
我正在学习Material Design,特别是我想使用Material Design自定义我的应用程序,也适用于较旧的Android版本.我正在阅读本指南:https://developer.android.com/training/material/compatibility.html#SupportLib
关于调色板,指南说:
要获取材料设计样式并使用Android v7支持库自定义调色板,请应用以下Theme.AppCompat主题之一:
<!-- extend one of the Theme.AppCompat themes -->
<style name="Theme.MyTheme" parent="Theme.AppCompat.Light">
<!-- customize the color palette -->
<item name="colorPrimary">@color/material_blue_500</item>
<item name="colorPrimaryDark">@color/material_blue_700</item>
<item name="colorAccent">@color/material_green_A200</item>
</style>
Run Code Online (Sandbox Code Playgroud)
当我尝试运行此代码时,我收到此错误:
错误:错误:找不到与给定名称匹配的资源:attr'colorAccent'.
...和colorPrimaryDark和colorPrimary的错误相同!如果我将此代码运行到values-v21/style.xml文件中,则将"android:"标记放在colorPrimary,colorPrimaryDark和colorAccent之前,如下所示:
<item name="android:colorPrimary">@color/material_blue_500</item>
<item name="android:colorPrimaryDark">@color/material_blue_700</item>
<item name="android:colorAccent">@color/material_green_A200</item>
Run Code Online (Sandbox Code Playgroud)
有用!
所以...我不明白我错在哪里:(我肯定更新了v7支持库
任何帮助将不胜感激!:)
小智 -3
尝试
parent="android:Theme.AppCompat.Light"
Run Code Online (Sandbox Code Playgroud)
或许还可以参考:
未找到资源 - Theme.AppCompat.Light.DarkActionBar
| 归档时间: |
|
| 查看次数: |
12886 次 |
| 最近记录: |