FloatingActionButton
extends ImageView
. So, it's simple as like introducing an ImageView
in your layout. Here is an XML sample.
<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:src="@drawable/somedrawable"
android:layout_gravity="right|bottom"
app:borderWidth="0dp"
app:rippleColor="#ffffff"/>
app:borderWidth="0dp"
is added as a workaround for elevation issues.