Disable the touch events for all the views

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

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

13条回答
  •  猫巷女王i
    2020-11-28 07:20

    Use this. returning true will indicate that the listener has consumed the event and android doesn't need to do anything.

    view.setOnTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            return true;
        }
    });
    

提交回复
热议问题