How to change FAB background color

后端 未结 4 1097
清歌不尽
清歌不尽 2021-01-07 17:23

I am using Floating Action Button and I want to change the background color.

Here is my code

    

        
4条回答
  •  無奈伤痛
    2021-01-07 17:48

    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"
    

提交回复
热议问题