1
嗨我写了这段代码,我不明白为什么给我syntax error on token "}", delet this token
?为什么我得到语法错误?
private class DemoView extends View{
public DemoView(Context context) {
super(context);
// TODO Auto-generated constructor stub
}//here***
final int x = 0;
final int y = 0;
this.setOnTouchListener(new View.OnTouchListener(){
public boolean onTouch(View v, MotionEvent e){
switch(e.getAction()){
case MotionEvent.ACTION_DOWN:
x++;
break;
case MotionEvent.ACTION_MOVE: // touch drag with the ball
// move the balls the same as the finger
x = x-25;
y = y-25;
break;
}
return true;
}//here***
}
感谢
编辑代码以使用字段代替'MoveData'类型的自动变量。 – 2011-02-27 21:28:05