I have tried with this code.
recyclerview.addOnItemTouchListener(new RecyclerView.OnItemTouchListener() {
@Override
public boolean onInterceptTouchEvent(@NonNull RecyclerView rv, @NonNull MotionEvent e) {
return true;
}
@Override
public void onTouchEvent(@NonNull RecyclerView rv, @NonNull MotionEvent e) {
}
@Override
public void onRequestDisallowInterceptTouchEvent(boolean disallowIntercept) {
}
});
Using this disabling the touch event is working fine. But scrolling not working. Thanks in advance.
By default I believe the RecyclerView will not have any click/touch enabled, so you don't really need to do anything to get the behavior you want. Adding a addOnItemTouchListener
this way will definitely block the scrolling behavior if you don't fully implement the onTouchEvent
which seems unnecessary in this case.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.