找不到与给定名称"android:Theme.Material"匹配的资源 [英] No resource found that matches the given name 'android:Theme.Material'

查看:263
本文介绍了找不到与给定名称"android:Theme.Material"匹配的资源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在阅读此答案后,我做出了 RecyclerView 在Android 3.0+上运行.但是values-v21中的styles.xml仍然会导致错误.

After reading this answer, I made RecyclerView ran it on Android 3.0+. But styles.xml in values-v21 still causes the error.

主题.

<!-- inherit from the material theme -->
<style name="AppTheme" parent="android:Theme.Material">

    <!-- Main theme colors -->
    <!-- your app's branding color (for the app bar) -->
    <item name="android:colorPrimary">#f00</item>
    <!-- darker variant of colorPrimary (for status bar, contextual app bars) -->
    <item name="android:colorPrimaryDark">#0f0</item>
    <!-- theme UI controls like checkboxes and text fields -->
    <item name="android:colorAccent">#00f</item>
</style>

错误.

错误:检索项目父项时出错:未找到匹配的资源 给定名称'android:Theme.Material'.

Error:Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Material'.

我需要支持来自Android 3.0.x(API级别11)的Android版本. <uses-sdk android:minSdkVersion="L" android:targetSdkVersion="L" />不是解决方案.

I need to support Android versions from Android 3.0.x (API level 11). <uses-sdk android:minSdkVersion="L" android:targetSdkVersion="L" /> is not a solution.

推荐答案

android:Theme.Material仅从API级别21开始受支持.您可以在android studio中看到如下错误消息:

android:Theme.Material is supported only from API level 21. You can see the error message in android studio as below:

android.Theme.Material requires API level 21(current min is 14)

这篇关于找不到与给定名称"android:Theme.Material"匹配的资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆