InflateException with FloatingActionButton from Official Design Library InflateException with FloatingActionButton from Official Design Library android android

InflateException with FloatingActionButton from Official Design Library


com.android.support:appcompat-v7:21+ added support for tinting widgets on devices running pre android 5.1 (API Level 21). To make use of it make sure you extend or set the AppCompat Theme and use app:backgroundTint instead of android:backgroundTint.

Example:

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


Just replace

<android.support.design.widget.FloatingActionButton ......android:backgroundTint/>

to

<android.support.design.widget.FloatingActionButton ......app:backgroundTint/>


If you're using a VectorDrawableCompat (Vector asset) you should use:

app:srcCompat="@drawable/x"

instead of:

android:src="@drawable/x"