skip to Main Content

Recycler view has scroll feature automatically . i want to disable that auto scroll. i want to use scrollview for scrolling .

2

Answers


  1. Chosen as BEST ANSWER

    I solved this problem by using nested scroll view.


  2. You should override the layoutManager of your recycleView for this. This way it will only disable scrolling, none of the other functionalities. You will still be able to handle click or any other touch events. For example:-

    public class CustomGridLayoutManager extends LinearLayoutManager {
        private boolean isScrollEnabled = true;
    
        public CustomGridLayoutManager(Context context) {
            super(context);
        }
    
        public void setScrollEnabled(boolean flag) {
            this.isScrollEnabled = flag;
        }
    
        @Override
        public boolean canScrollVertically() {
            //Similarly you can customize "canScrollHorizontally()" for managing horizontal scroll
            return isScrollEnabled && super.canScrollVertically();
        }
    }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search