Dhaval Gulhane
Dhaval Gulhane

Reputation: 157

Scrolling issue in RecyclerView in NestedScrollView

I have added RecyclerView in NestedScrollView like this

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

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

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

And in Java code I have specified the height like this

recyclerView.setNestedScrollingEnabled(false);
recyclerView.setHasFixedSize(true);
recyclerView.setAdapter(new DataManager());   
recyclerView.setHasFixedSize(true);
recyclerView.setMinimumHeight(3000);

Can anyone tell me what height should I pass so that RecyclerView work properly?

Upvotes: 2

Views: 1275

Answers (1)

Vijay Sanghavi
Vijay Sanghavi

Reputation: 340

Try this.

Here setMinimumHeight(height) is used where height is calculated dynamically.

Upvotes: 1

Related Questions