No resource found that matches the given name (at 'android:color Primary')

和自甴很熟 提交于 2019-12-04 07:42:46

android:Theme.Material requires API level 21 and so it's cleared that your minSDKVersion is lower than 21.

If you really want to develop app for API 21 then declare android:minSDKVersion=21.

And if in case you want to provide compatibility to lower version then you need to use support library, which is commonly known as AppCompat library.

You can access above attributes using AppCompat:

 <item name=”colorPrimary”>@color/primary</item>
 <item name=”colorPrimaryDark”>@color/primary_dark</item>

Actually, you can use this attribute, using the support library:

<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>

android:colorPrimary is supported only from API level 21. You can see the error message in android studio and in eclipse below:

android:colorPrimary requires API level 21 (current min is 14)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!