How to set a gradient background to a Material Button?

前端 未结 4 1705
甜味超标
甜味超标 2021-01-17 11:57

I\'m currently using this code but the background is not changing.It is still showing accent-color as background.



        
4条回答
  •  独厮守ぢ
    2021-01-17 12:14

    Please read the documentation for Material button, from here

    It says, "For filled buttons, your theme’s colorPrimary provides the default background color of the component, and the text color is colorOnPrimary. For unfilled buttons, your theme’s colorPrimaryprovides the default text color of the component, and the background color is transparent by default."

    I think that's the reason you are seeing some other color(accent-color) also please check the attributes that set background colour.

    Following attributes are mentioned :

    app:backgroundTint

    app:backgroundTintMode

提交回复
热议问题