触摸事件 按下 移动 弹起

 b1.setOnTouchListener(new OnTouchListener() {
			
			@Override
			public boolean onTouch(View v, MotionEvent event) {
				switch (event.getAction()) {
				case MotionEvent.ACTION_DOWN:
					//按下
					break;
				case MotionEvent.ACTION_MOVE:
					//移动
					break;
				case MotionEvent.ACTION_UP:
					//抬起
					break;
				}
				return true;
			}
		});

按键监听 
 public boolean onKeyDown(int keyCode, KeyEvent event) {
		}
 public boolean onKeyUp(int keyCode, KeyEvent event) {
		}
原文地址:https://www.cnblogs.com/sode/p/2172133.html