I try change color to MaterialButton with this code:
var materialButton = findViewByid(R.id....) as MaterialButton
materialButton.setBackgroundColor( ContextCompat.getColor(this@MyActivity, R.color.myCustomColor));
With a normal Button, it works.
Anyone have any ideas?
Best Answer
I found the answer which is as below:
I changed the following line
to
I tested it that way and it worked perfectly.