I encountered a problem with the Button
view when I set a background to it using the android:background
attribute in xml. Before I set the background,
For people looking for doing it in the code (Not in XML), you can use this:
button.getBackground().setColorFilter(button.getContext().getResources().getColor(R.color.colorAccent), PorterDuff.Mode.MULTIPLY);
this didn't change the size of the button and works with the old android versions too. Several methods discussed here, but this one worked perfect.