Android OnTouchListener押下と持ち上げ
3383 ワード
書き方一:
書き方2:
転載先:https://www.cnblogs.com/jenson138/p/4532715.html
1 private OnTouchListener pressOnTouchListener = new OnTouchListener(){
2
3 @Override
4 public boolean onTouch(View view, MotionEvent event) {
5 // TODO Auto-generated method stub
6 switch (event.getAction()){
7 case MotionEvent.ACTION_DOWN:
8 //
9 break;
10 case MotionEvent.ACTION_UP:
11 //
12 break;
13
14 }
15 return false;
16 }
17
18 };
書き方2:
1 class myOntouchListener implements OnTouchListener{
2
3 @Override
4 public boolean onTouch(View arg0, MotionEvent arg1) {
5 // TODO Auto-generated method stub
6 return false;
7 }
8
9 }
転載先:https://www.cnblogs.com/jenson138/p/4532715.html