Abhishek Kumar Abhishek Kumar - 3 months ago 9
Android Question

Can an image be used in FloatingActionButton?

I want to use an image as background of a

FloatingActionButton
.

I know that the default background color which is
colorAccent
and we can change it easily. But what about the image as its background ?

If I can then how?

Pictorial explanation will always be appreciated.

Answer

Just use like this

<android.support.design.widget.FloatingActionButton
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:backgroundTint="@android:color/transparent"
    android:src="@drawable/icon" />