Reputation: 923
Created Recyclerview inside the nextedscrollview. Displaying recylerview abruptly cuts at the first item in the recyclerview. But when I rotate the phone in landscape mode, and rotate back to portrait mode, the recyclerview list is shown correctly with the scrolling. Can someone please point out what is going wrong here?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".form.FragmentFormSummary">
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v7.widget.CardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal">
<Spinner
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal">
</Spinner>
</android.support.v7.widget.CardView>
<com.github.mikephil.charting.charts.PieChart
android:layout_width="300dp"
android:layout_height="300dp"
android:layout_gravity="center_horizontal"/>
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:nestedScrollingEnabled="false"
android:paddingTop="16dp"
android:paddingBottom="16dp"
android:clipToPadding="false"
android:clipChildren="false">
</android.support.v7.widget.RecyclerView>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</LinearLayout>
Upvotes: 0
Views: 82
Reputation: 1674
Don't use NestedScroll view as wrapper to RecyclerView. This is not good practice.
You should use RecyclerView ViewTypes instead: https://medium.com/@gilbertchristopher/a-recyclerview-with-multiple-view-type-22619a5ad365
Upvotes: 1
Reputation: 188
you need add
app:layout_behavior="@string/appbar_scrolling_view_behavior"
to you recycler view
Upvotes: 0