Can't use android:background with button from the new material components

后端 未结 4 1785
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-18 20:52

I\'m using the new material components com.google.android.material:material with android x but I can\'t set a custom background to the button.

I know that I

4条回答
  •  爱一瞬间的悲伤
    2021-02-18 21:43

    I face the same issue when I use state drawable in a Button but It does not change the background of the button. After searching for a long time, I found 2 solutions as below:
    The first solution is change the application theme from MaterialComponents to AppCompat in values/themes.xml file. then state drawable will work well.

    to