1. Are you ready for the Galaxy S20? Here is everything we know so far!

NestedScrollView does not scroll when RecyclerView scrolls

Discussion in 'Android Development' started by umtblbl, Aug 3, 2019.

  1. umtblbl

    umtblbl Member
    Thread Starter

    Hi friends, I have a RecyclerView in NestedScrollView. I set the size of the RecyclerView according to the screen size of the user. In this case, the recyclerview layout_height is 700dp, for example.

    In this case, the problem is; The NestedScrollView does not scroll while the recyclerView is scrolling, and the nestedScrollView.setOnScrollChange method is not triggered.

    What I want is; When scrolling on the recyclerView, NestedScrollView is also shifted and the nestedscrollView.setOnScrollChange method is triggered in any case. I've shared the layout below.
    Is there anyone who can help?

    Code (Text):
    1.  
    2.  
    3. <?xml version="1.0" encoding="utf-8"?>
    4. <androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    5.     xmlns:app="http://schemas.android.com/apk/res-auto"
    6.     xmlns:tools="http://schemas.android.com/tools"
    7.     android:id="@+id/nestedScrollView"
    8.     android:layout_width="match_parent"
    9.     android:layout_height="match_parent"
    10.     tools:context=".MainActivity">
    11.  
    12.             <LinearLayout
    13.                 android:layout_width="match_parent"
    14.                 android:layout_height="match_parent"
    15.                 android:orientation="vertical">
    16.  
    17.                 <androidx.appcompat.widget.SearchView
    18.                     android:elevation="10dp"
    19.                     android:id="@+id/searchView"
    20.                     android:layout_width="match_parent"
    21.                     android:layout_height="100dp"
    22.                     android:layout_margin="4dp"
    23.                     android:layout_marginStart="8dp"
    24.                     android:layout_marginTop="8dp"
    25.                     android:layout_marginEnd="8dp"
    26.                     android:background="@color/colorAccent" />
    27.  
    28.                 <androidx.recyclerview.widget.RecyclerView
    29.                     android:id="@+id/recyclerView"
    30.                     android:layout_width="match_parent"
    31.                     android:layout_height="wrap_content"
    32.                     android:layout_margin="4dp"
    33.                     android:layout_marginTop="8dp"/>
    34.             </LinearLayout>
    35.  
    36.  
    37. </androidx.core.widget.NestedScrollView>
    38.  
     


Loading...
Similar Threads - NestedScrollView does scroll
  1. chris096
    Replies:
    5
    Views:
    86
  2. Paul Cooper
    Replies:
    1
    Views:
    226
  3. Nirupa Rathnayake
    Replies:
    4
    Views:
    214
  4. akaskhu
    Replies:
    2
    Views:
    342
  5. NewDroidGA
    Replies:
    0
    Views:
    562
  6. angrypidgeon
    Replies:
    6
    Views:
    468
  7. chinnar
    Replies:
    0
    Views:
    472
  8. Sudhakar Reddy
    Replies:
    14
    Views:
    636
  9. MartinW12
    Replies:
    6
    Views:
    319
  10. umtblbl
    Replies:
    1
    Views:
    383

Share This Page

Loading...