After reading this answer, I made RecyclerView ran it on Android 3.0+. But styles.xml
in values-v21
still causes the error.
Theme.
<!-- 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:Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Material'.
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
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)
If you use the support library, you can safely use those attributes, and they will work (as much as the OS allows) :
<style name="AppTheme" parent="@style/Theme.AppCompat.Light">
<item name="colorPrimary">...</item>
</style>
You can also use the others:
<item name="colorPrimaryDark">...</item>
<item name="colorAccent">...</item>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With