Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

recycler view 23.2.0 fling scrolling

After updating recycler view to 23.2.0, I noticed that the fling scrolling is not working anymore as it used to be before. I haven't changed any other code, apart from accommodating the new auto resizing of the recycler view. Has anybody else faced the similar problem?

Here's my code:

XML :

 <android.support.v4.widget.NestedScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">

            <android.support.v7.widget.RecyclerView
                android:id="@+id/my_recycler_view"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />
        </LinearLayout>

    </android.support.v4.widget.NestedScrollView>

Java :

 mRecyclerView = (RecyclerView) findViewById(R.id.my_recycler_view);
 mRecyclerView.setHasFixedSize(true);
 mRecyclerView.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL,false));
like image 284
Yash Avatar asked Feb 01 '26 11:02

Yash


1 Answers

This worked for me:

mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false) {

        @Override
        public boolean canScrollHorizontally() {
            return false;
        }

        @Override
        public boolean canScrollVertically() {
            return false;
        }
    });
like image 155
Andrei Buneyeu Avatar answered Feb 03 '26 00:02

Andrei Buneyeu