要使用setBackgroundcolor
方法改变Android按钮的背景色,可以按照以下步骤操作:
Button myButton = findViewById(R.id.myButton);
myButton.setBackgroundColor(Color.RED); // 设置背景色为红色
myButton.setWidth(200); // 设置宽度为200像素
myButton.setHeight(100); // 设置高度为100像素
这样,按钮的背景色将变为红色,并且宽度和高度都将改变为指定的像素大小。您可以根据需要调整背景色和大小的值。