Disable the touch events for all the views

前端 未结 13 1387
暗喜
暗喜 2020-11-28 06:53

What\'s the best way to disable the touch events for all the views?

13条回答
  •  Happy的楠姐
    2020-11-28 06:56

    Override the dispatchTouchEvent method of the activity and like this:

    @Override
    public boolean dispatchTouchEvent(MotionEvent ev){      
      return true;//consume
    }
    

    If you return true all touch events are disabled.

    Return false to let them work normally

提交回复
热议问题