Android资源链接失败值,styles.xml

  

所以我想创建一个新的android项目,然后突然出现此错误,提示Android资源链接失败,下面是我的代码。

Styles.xml

resources>

    <!-- Base application theme. -->
    <style type ="attr" name="Apptheme" parent="Theme.AppCompat.Light.DarkactionBar">
        <!-- Customize your theme here. -->
        <item type="attr" name="colorPrimary">@color/colorPrimary</item>
        <item type="attr" name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item type="attr" name="coloraccent">@color/coloraccent</item>
    </style>

</resources>

显示错误

C:\Users\ASUS\Desktop\Rapih\Re_Mind\app\src\main\res\values\styles.xml:4:5-9:13: AAPT: error: style attribute 'attr/colorPrimary (aka app.com.re_mind:attr/colorPrimary)' not found.

xjj070324why 回答:Android资源链接失败值,styles.xml

使用类似这样的方法不要添加type属性。这可能对您有帮助。

 <style name="AppTheme" parent="Base.Theme.MaterialComponents.Light.DarkActionBar">
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
</style>
本文链接:https://www.f2er.com/3139517.html

大家都在问