使用Android设计支持库时出错:未找到attr backgroundTint

ige*_*ece 15 eclipse android adt

试图在我的项目中使用新的设计支持库,AAPT会抛出以下错误:

Description: Error: No resource found that matches the given name: attr 'backgroundTint'.
Resource:    /design/res/values/styles.xml
Location:    line 21 
Run Code Online (Sandbox Code Playgroud)

这是受影响的条目styles.xml:

<style name="Widget.Design.FloatingActionButton" parent="android:Widget">
    <item name="android:background">@drawable/fab_background</item>
    <item name="backgroundTint">?attr/colorAccent</item>
    <item name="fabSize">normal</item>
    <item name="elevation">@dimen/fab_elevation</item>
    <item name="pressedTranslationZ">@dimen/fab_translation_z_pressed</item>
    <item name="rippleColor">?attr/colorControlHighlight</item>
    <item name="borderWidth">@dimen/fab_border_width</item>
</style>
Run Code Online (Sandbox Code Playgroud)

我的目标是使用SDK 21,将min SDK设置为17.

编辑:我有最新的SDK工具.

Kam*_*han 32

将appcompat-v7库添加为设计库项目的依赖项.它为我解决了同样的错误.我觉得它对你很有帮助.


thi*_*olr 16

我能够用@igece解决方案解决这个问题,但后来我发现真正的问题已经过时了appcompat-v7 library.

将其升级到最新版本后,无需在Google的库中编辑任何内容.