我试图在下面的代码中使用material Theme
我的styles.xml文件
<resources>
<!--
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">
<!--
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="Android:Theme.Material">
<item name="android:colorPrimary">@color/primary</item>
</style>
</resources>在执行此操作时,我会收到以下错误:
Error retrieving parent for item: No resource found that matches the given name 'Android:Theme.Material' 这是怎么回事?
发布于 2014-11-12 06:45:30
遵循以下步骤1.首先在res/values文件夹名(color.xml)中定义一个新的xml文件。2.然后定义您的自定义颜色为。
<resources>
<color name="primary">#03f</color>
</resources>问题是您的主题提供了一个自定义的位置,但是它不知道@color/主值。
现在再试着运行该项目。
记住Set android:minSdkVersion="L“android:targetSdkVersion="L"
发布于 2014-08-12 07:07:27
设置android:minSdkVersion="L" android:targetSdkVersion="L"。
您需要执行以下步骤
compileSdkVersion设置为“android”minSdkVersion设置为“L”targetSdkVersion设置为“L”阅读更多关于https://developer.android.com/preview/setup-sdk.html#createProject的信息
发布于 2014-11-12 09:15:41
在撰写本报告时,@Pankaj的回答是正确的。现在API 21正式发布了,有些地方发生了变化。
要在项目中使用材料主题,您必须:
然后你可以选择其中之一:
https://stackoverflow.com/questions/25257737
复制相似问题