-2
我必须添加侦听器到可以改变编辑文本框中的文本的按钮小部件,但是编译器给出了setText
的语法错误。JAVA,Android开发
Button button1 = (Button) findViewById(R.id.Button1);
button1.setOnClickListener(new Button.OnClickListener() {
public void onClick(View v);
TextView text1 = (TextView) findViewById(R.id.text1);
text1.setText("Please go"); // compiler shows the error here
});
你的代码,设置文本应该是里面的方法'的onClick(视图v )'? – sanastasiadis