我尝试使用以下代码将颜色更改为MaterialButton:
var materialButton = findViewByid(R.id....) as MaterialButton
materialButton.setBackgroundColor( ContextCompat.getColor(this@MyActivity, R.color.myCustomColor));
Run Code Online (Sandbox Code Playgroud)
使用普通按钮,它可以工作.有人有主意吗?