I use the built-in theme for my Android app:
<style name="AppTheme" parent="android:Theme.Black"> </style>
I am pleased with this theme, except that I want to change the background color of the button. Here's what it looks like by default:

This is what happens when I add a background color to this button ( android:background="@color/play_bg" ):

Hey!? He basically resized all button size, padding and margins!
I managed to get the expected result using the backgroundTint property ( android:backgroundTint="@color/play_bg" ):

Unfortunately, this is only supported from API version 21, which is unacceptable to me.
So, two questions:
- Why changes in background noise with other button properties?
- How to get the expected result without
backgroundTint ?
And the bonus question: how can I get the expected result programmatically (I have dynamic buttons in my application, so that would be very useful)?
java android button styles
Eric Leibenguth
source share