In the layout's XML file:
<imagebutton
Android:id= "@+id/fabbutton"
Android:layout_width= "56DP"
android:layout_height= "56DP"
Android:layout_gravity= "Bottom|right"
Android:layout_marginbottom= "16DP"
android:layout_marginright= "16DP"
android:background= "@drawable/fab_background"//round background
android:src= "@drawable/IC_FAVORITE_OUTLINE_WHITE_24DP"//Circle on the picture, set yourself
/>
Fab_background.xml under the Drawable folder:
<?xml version= "1.0" encoding= "Utf-8"?>
<!--drawable/btn_fab_default.xml-->
<layer-list xmlns:android= "Http://schemas.android.com/apk/res/android" >
Set border
<item android:bottom= "0DP" android:left= "2DP" android:right= "2DP" android:top= "2DP" >
<shape android:shape= "Oval" >
<solid android:color= "@color/color_shadow"/>
</shape>
</item>
Set border
<item android:bottom= "2DP" android:left= "2DP" android:right= "2DP" android:top= "2DP" >
<shape android:shape= "Oval" >
<solid android:color= "@color/color_primary_red"/>
</shape>
</item>
</layer-list>
The Color.xml in values
<?xml version= "1.0" encoding= "Utf-8"?>
<resources>
<color name= "color_primary_red" > #f44336 </color>
<color name= "Color_primary_red_dark" > #d32f2f </color>
<color name= "Color_primary_green" > #4caf50 </color>
<color name= "Color_primary_green_dark" > #388e3c </color>
<color name= "Color_shadow" > #44000000 </color>
</resources>
The realization of the development of Android bottom corner round button