Swipe detection for each row of listview

后端 未结 6 762
长情又很酷
长情又很酷 2021-02-18 16:32

I have a list of videos located in the sd-card. At this point, I just need help in creating gestures or swipe detection for each row in the list view. Thanks to this question at

6条回答
  •  Happy的楠姐
    2021-02-18 17:09

    As Per My Opinion is Use Boolean for the item,When that item is touched set as true,Using onTouchListener,

    ListItem.setOnTouchListener(new View.OnTouchListener() {
    
            @Override
            public boolean onTouch(View arg0, MotionEvent event) {
                click=true;
                return click;
    
    
            }
    
        });`
    

    Then You Can Override This:

     @Override
    public boolean dispatchTouchEvent(MotionEvent ev){
    super.dispatchTouchEvent(ev);
    Log.v("Inside", "=====Dispatch Event===");
    if(click){
        Log.v("Inside", "=====Dispatch Event=T==");
        click=false;
         return gestureDetector.onTouchEvent(ev);
    
    }else{
        return false;
    }
    
    }
    

提交回复
热议问题