How to get a continuous Touch Event?

后端 未结 7 1579
死守一世寂寞
死守一世寂寞 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; 
    
             }
    
    0 讨论(0)
提交回复
热议问题