流程:
常见的回调方法:
代码示例:
@Override
public boolean onTouchEvent(MotionEvent event) {
Toast.makeText(getApplicationContext(),"触摸",Toast.LENGTH_SHORT).show();
return super.onTouchEvent(event);
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
Toast.makeText(getApplicationContext(),"按下",Toast.LENGTH_SHORT).show();
return super.onKeyDown(keyCode, event);
}
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
Toast.makeText(getApplicationContext(),"抬起",Toast.LENGTH_SHORT).show();
return super.onKeyUp(keyCode, event);
}