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="https://stackoverflow.com/questions/30870443/@drawable/icon"
    app:backgroundTint="@color/accent"
    app:borderWidth="0dp" />

Leave a Comment