I would like to know how to set the button color programatically? I have coded the following but fails:
Button11.setBackgroundColor(R.color.red);
Old thread, but learned something new, hope this might help someone.
If you want to change the background color but retain other styles, then below might help.
button.getBackground().setColorFilter(ContextCompat.getColor(this, R.color.colorAccent), PorterDuff.Mode.MULTIPLY);