怎么在android上实现触摸按键

解决方案 »

  1.   

    重写:
        public boolean onKeyDown(int keyCode, KeyEvent event) {}
        public boolean onKeyUp(int keyCode, KeyEvent event) {}
        public boolean onTouchEvent(MotionEvent event) {}
    三个方法再复杂点就是实现OnGestureListener接口
    然后IDE会提示你要实现对应的方法的基本有几个方法,按下时做什么,抬起时做什么,拖动时做什么
      

  2.   

    没看懂,是OnClickListener 或者 OnTouchListener 吧
      

  3.   

    没看明白如果是触摸事件,楼上都已经回答了。
    直接在相应的activity或者View里用就行了。
      

  4.   

    楼上的都可以实现了,看api说明有
      

  5.   

    在view中声明OnTouchListener函数,在函数内处理触摸动作 MoitionEvent.ACTION_DOWN,MoitionEvent.ACTION_MOVE等事件
      

  6.   

    public boolean onTouchEvent(MotionEvent event) {}
    实现上面方法就行了。
    http://blog.csdn.net/ch_984326013/article/details/6654270