How to get a continuous Touch Event?

后端 未结 7 1655
死守一世寂寞
死守一世寂寞 2021-01-17 14:01

My class extends View and I need to get continuous touch events on it.

If I use:

public boolean onTouchEvent(MotionEvent me) {

    if(me.getAction()         


        
7条回答
  •  一个人的身影
    2021-01-17 14:38

    This might help,

    requestDisallowInterceptTouchEvent(true);
    

    on the parent view, like this -

            @Override
            public boolean onTouch(View view, MotionEvent motionEvent) {
                view.getParent().requestDisallowInterceptTouchEvent(true);
                switch(motionEvent.getAction()){
                }
    
                return false; 
    
             }
    

提交回复
热议问题