Xml 无法实例化浮动操作按钮/错误膨胀

Xml 无法实例化浮动操作按钮/错误膨胀,xml,android-studio,gradle,floating-action-button,Xml,Android Studio,Gradle,Floating Action Button,我一直在扯我的头发;它工作得很好(很好,几乎没有正确浮动),然后在我添加android:backgroundTint=“@color/fab”后不久,它突然停止了,因为最小SDK是19 要尝试修复它,我有: 更新的Android Studio/SDK 使缓存无效/重新启动 重建项目 已确认targetSdkVersion 23 确认compile'com.android.support:design:23.1.1' 已确认classpath'com.android.tools.build:gr

我一直在扯我的头发;它工作得很好(很好,几乎没有正确浮动),然后在我添加
android:backgroundTint=“@color/fab”
后不久,它突然停止了,因为最小SDK是19

要尝试修复它,我有:

  • 更新的Android Studio/SDK
  • 使缓存无效/重新启动
  • 重建项目
  • 已确认
    targetSdkVersion 23
  • 确认
    compile'com.android.support:design:23.1.1'
  • 已确认
    classpath'com.android.tools.build:gradle:1.5.0'
  • 已确认
如果这是显而易见的,那就快到凌晨5点了,非常抱歉,但我不知道还有什么好尝试的。XML:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/com.whereintheworld.com"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <android.support.design.widget.CoordinatorLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <LinearLayout android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">

            <ListView xmlns:android="http://schemas.android.com/apk/res/android"
                android:id="@+id/tracking_task_list"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />

        </LinearLayout>

        <android.support.design.widget.FloatingActionButton
            android:id="@+id/fab"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_margin="16dp"
            android:clickable="true"
            android:src="@drawable/fab_ic_add"
            android:backgroundTint="@color/fab"
            app:layout_anchor="@id/tracking_task_list"
            app:layout_anchorGravity="bottom|right|end" />

    </android.support.design.widget.CoordinatorLayout>

</RelativeLayout>

com.android.support:appcompat-v7:21+
添加了对运行pre
android 5.1(API级别21)的设备上的着色小部件的支持。
。要使用它,请确保扩展或设置AppCompat主题,并使用
app:backgroundTint
而不是
android:backgroundTint

例如:

<android.support.design.widget.FloatingActionButton 
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/fab"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_margin="16dp"
    android:src="@drawable/icon"
    app:backgroundTint="@color/accent"
    app:borderWidth="0dp" />