I am using Floating Action Button and I want to change the background color.
Here is my code
<android.support.design.widget.FloatingActionButton
android:id="@+id/btnfab"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_gravity="right|center_vertical"
android:layout_marginBottom="20dp"
android:src="@drawable/search" />
Here is the code I am using to try and achieve this:
1- android:background="@color/mycolor"
2- android:backgroundTint="@color/white"
I am also getting corners on my FAB as shown in image. How should I remove those corner shadows?
You can remove problematic shadow by adding this attributes to your FloatingActionButton
:
app:borderWidth="0dp"
app:elevation="6dp"
There is no background color for FloatingActionButton
. You change this component color by:
app:backgroundTint="@color/YOURCOLOR"
Remember to have in your parent layout following line:
xmlns:app="http://schemas.android.com/apk/res-auto"