Reputation: 31
I am coding in android studio for some months and everything worked great. In the last 2 weeks I updated android studio and since then, every time I put a button its color is defined as purple no matter what I am doing, even if I change its background. I tried to change it from the xml and also from the java file but without success. If someone knows how to change it, it would be very helpful. Thanks for answers.
Upvotes: 3
Views: 8193
Reputation: 1
In Value/Themes/Themes.xml
Instead of use Material3
, use AppCompat
for example if you want this theme "Theme.Material3.DayNight.NoActionBar"
use this "Theme.AppCompat.DayNight.NoActionBar"
Upvotes: 0
Reputation: 1
Change the theme.xml
style name="Theme.PROJECTNAME" parent="Theme.AppCompat.Light.NoActionBar">
Then the button without background will become grey and can be edited by color and drawable
Upvotes: 0
Reputation: 8288
Setting the app:backgroundTint
to the color or transparent as well fixed this for me.
Upvotes: 1
Reputation: 41
Instead of button
use <androidx.appcompat.widget.AppCompatButton>
Upvotes: 4