0
下面的代碼將背景顏色更改爲黑色,無論我以何種顏色通過 參數。如何在運行時在Android中更改Button的BackgroundColor?
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
b = (Button)findViewById(R.id.Button01);
b.setBackgroundColor(R.color.red);
}
任何幫助?