Android : Android Studio shows error in v21/styles because of "android:" prefix

on Sunday, April 19, 2015


I created a new project and there wasn't a v21 folder so I created one, added the "styles" file also and now after writing my style, I'm getting an error because of the "android:" prefix.


my code:


styles :



<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="AppTheme.Base">
<!-- Customize your theme here. -->
</style>

<style name="AppTheme.Base" parent="Theme.AppCompat.Light">
<item name="colorPrimary">@color/maincolor</item>
<item name="colorPrimaryDark">@color/statusbar</item>
</style>


v21/styles:



<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="AppTheme.Base">
<!-- Customize your theme here. -->
<item name="android:colorPrimary">@color/maincolor</item>
<item name="android:colorPrimaryDark">@color/statusbar</item>
</style>


Android Studio marks "android:colorPrimary" and "android:colorPrimaryDark" as an error, it says "requires API level 21 (current min is 14)" The app runs but my style won't show... What am I doing wrong?


0 comments:

Post a Comment