看完this answer ,我做了RecyclerView在 Android 3.0+ 上运行它。但是styles.xml
在values-v21
仍然会导致错误。
主题。
<!-- 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>
错误。
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" />
不是解决方案。
最佳答案
android:Theme.Material
仅支持 API 级别 21。您可以在 android studio 中看到如下错误消息:
android.Theme.Material requires API level 21(current min is 14)
关于android - 找不到与给定名称 'android:Theme.Material' 匹配的资源,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25688373/