public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.testevent);
final TextView Text = (TextView) findViewById(R.id.text1); // 获得句柄
final Button Button1 = (Button) findViewById(R.id.button1);
final Button Button2 = (Button) findViewById(R.id.button2);
Button1.setOnClickListener(new OnClickListener() { // 实现行为功能
public void onClick(View v) {
Text.setBackgroundColor(Color.RED);
}
});
Button2.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
Text.setBackgroundColor(Color.GREEN);
}
});
}
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请
点击举报。