Set Background color from code
…
mButton . setBackgroundColor ( Color . rgb ( 27 , 161 , 226 )); OR mButton .setBackgroundColor(Color.parseColor("#2783B6")); OR mButton .setBackgroundColor(getResources().getColor(R.color.red)); oR mButton .setBackgroundColor(Color.GREEN);
Read more