0

selector drawable xml not working when applying it to a button on the screen, whenever i change the background of the button to the drawable xml the button is not being pressed when i run the app and it's color doesn't change, when i change the background to a static color it returns to it's normal behavior and is press-able, any solutions? selector xml activity xml

1 Answers1

0

I got this error in the past and from what I lean is that From Android Studio 4.1 many of the components started using the Material Components And sets up the default theme to be based on Theme.material components.DayNight.DarkActionBar.

And because of this, any Button elements in a layout get turned into MaterialButton, and MaterialButton that ignores android:background. In my case, I solved this with -

app:backgroundTint="@null"    //just need this
android:background="@drawable/background_button"

and if this does not work for you, you can check this answer here, which I used in the past, hope it's helps.

Rohit Bhati
  • 371
  • 2
  • 11