只要按住按钮,我就想一遍又一遍地打印一封信。例如,如果我推动R2 秒,我应该会看到:
"RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR"
我试过这个:
public void addListenerOnUP() {
Button b = (Button) findViewById(R.id.up);
b.setOnTouchListener(new OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
// TODO Auto-generated method stub
String p = "R";
//print ...
return true;
}
});
}
但它只在用户移动手指时有效,而不是在他们触摸屏幕时。我怎样才能让“R”重复?