0

I have a question about Recyclerview usage.When I add a recyclerview inside nestedscrollview , it expands but when add listview inside nestedscrollview ,it does not expand.Also when Add multiple recyclerviews inside nestedscrollview , all recyclerviews expand.What is the difference between listview and recyclerview here?

example:

<android.support.v4.widget.NestedScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
tools:context=".MainActivity">

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

    <android.support.v7.widget.RecyclerView
        android:id="@+id/myrecycleview"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:nestedScrollingEnabled="true"
        android:scrollbars="vertical"
        app:layoutManager="android.support.v7.widget.LinearLayoutManager"/>


    <Button
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="My Button"/>


</LinearLayout>

here Button is visible end of the scrollview but

<android.support.v4.widget.NestedScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
tools:context=".MainActivity">

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

    <ListView
        android:id="@+id/mylistview"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:nestedScrollingEnabled="true"
        android:scrollbars="vertical"
    />


    <Button
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="My Button"/>


</LinearLayout>

here button is not visible.

ahmetvefa53
  • 581
  • 6
  • 20

0 Answers0