В XML вы можете установить, как это:
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|right"
android:layout_margin="16dp"
android:src="@drawable/ic_add_black"
app:borderWidth="0dp"
app:fabSize="mini" />
и в Java файл можно установить следующим образом:
ImageView iconFAB = new ImageView(this);
iconFAB.setImageResource(R.drawable.ic_action_new);
//set the appropriate background for the main floating action button along with its icon
mFAB = new FloatingActionButton.Builder(this)
.setContentView(iconFAB)
.setBackgroundDrawable(R.drawable.selector_button_pink)
.build();
здесь selector_button_pink .xml код файла
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/button_action_red_touch" android:state_pressed="true"></item>
<item android:drawable="@drawable/button_action_red" android:state_pressed="false"></item>
</selector>
Да, может. это уже задано раньше, и ответ [здесь] (http://stackoverflow.com/questions/32036656/setting-src-and-background-for-floatingactionbutton) –