通过以下代码示例解决此问题:
首先,在你的 layout xml 文件中创建一个 Button 控件,并为其设置 id 和属性等,例如:
然后,在你的 activity 或 fragment 中设置该 Button 控件的背景颜色,例如:
Button myButton = findViewById(R.id.my_button);
myButton.setBackgroundColor(getResources().getColor(R.color.new_button_color));
其中,R.color.new_button_color
为你想要改变的 Button 的新颜色的颜色值。
最后,重新编译并运行你的应用程序,该 Button 将展现新的背景颜色。