您好,我有 10 个按钮,编号从 0 到 9,我希望能够将这些值分配给按钮,并在按下它后将该值输入到编辑文本框中。到目前为止,我已经创建了按钮并设置了点击侦听器。预先感谢您的任何帮助。:)
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.eigth);
Button q81 = (Button) findViewById(R.id.eightb1);
Button q82 = (Button) findViewById(R.id.eightb2);
Button q83 = (Button) findViewById(R.id.eightb3);
Button q84 = (Button) findViewById(R.id.eightb4);
Button q85 = (Button) findViewById(R.id.eightb5);
Button q86 = (Button) findViewById(R.id.eightb6);
Button q87 = (Button) findViewById(R.id.eightb7);
Button q88 = (Button) findViewById(R.id.eightb8);
Button q89 = (Button) findViewById(R.id.eightb9);
Button q80 = (Button) findViewById(R.id.eightb0);
EditText editText = (EditText) findViewById(R.id.editText1);
editText.getText();
q81.setOnClickListener((OnClickListener) this);
q82.setOnClickListener((OnClickListener) this);
q83.setOnClickListener((OnClickListener) this);
q84.setOnClickListener((OnClickListener) this);
q85.setOnClickListener((OnClickListener) this);
q86.setOnClickListener((OnClickListener) this);
q87.setOnClickListener((OnClickListener) this);
q88.setOnClickListener((OnClickListener) this);
q89.setOnClickListener((OnClickListener) this);
q80.setOnClickListener((OnClickListener) this);