How to change FAB background color

后端 未结 4 1077
清歌不尽
清歌不尽 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:44

    Please update your android support and android material design libraries in build.gradle.

    (Add please your build.gradle file above)

    According to these sites:

    • [CodePath] Floating Action Buttons,
    • [Big Nerd Ranch] Floating Action Buttons in Android Lollipop

    and Android Developers reference you should use only:

       android:backgroundTint="@color/white"
    

    As I remember, this shadow is well-know problem for Floating action buttons, so please take a look at these additional libraries:

    http://android-arsenal.com/tag/173

    which may help you to replace this broken element.

    Check also:

    • Change color of Floating Action Button from Appcompat 22.2.0 programmatically
    • Change background on FloatingActionButton?

    Hope it help.

提交回复
热议问题