0

I have Problem : RecyclerView not scrolling. Design : cover Image then RecyclerView with menu. it show RecyclerView but I cant touch to go down in it just suck I have tired to : Replace menu with RecyclerView but it make big problem and setNestedScrollingEnabled Too. any slove?

<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout 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:fitsSystemWindows="true"
    tools:context=".MainActivity">

    <!--    background Logo-->
    <ImageView
        android:background="@color/brown"
        android:layout_width="match_parent"
        android:layout_height="250dp"
        android:src="@drawable/haneenrama"
        android:contentDescription="@string/name_offical"
        android:scaleType="centerCrop"
        ></ImageView>

    <!--    RecyclerView-->
    <androidx.core.widget.NestedScrollView
        android:layout_width="match_parent"
        android:layout_marginTop="250dp"
        android:layout_height="match_parent">
        <androidx.recyclerview.widget.RecyclerView
            android:id="@+id/recycler"
            android:layout_width="match_parent"
            android:layout_height="match_parent">
        </androidx.recyclerview.widget.RecyclerView>
    </androidx.core.widget.NestedScrollView>

<!--menu-->
    <androidx.drawerlayout.widget.DrawerLayout
        android:layout_width="match_parent"
        tools:openDrawer="end"
        android:layout_height="match_parent"
        android:id="@+id/drawer_layout">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">
        <androidx.appcompat.widget.Toolbar
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/toolbar"
            android:background="@color/blue"
            ></androidx.appcompat.widget.Toolbar>
    </RelativeLayout>

<com.google.android.material.navigation.NavigationView
    android:id="@+id/NavigationView"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:background="@color/white"
    app:itemTextColor="@color/black"
    app:itemIconTint="@color/black"
    app:itemBackground="@color/rmade"
    app:menu="@menu/main_menu"
    app:headerLayout="@layout/menu_header"
    android:layout_gravity="start"
    ></com.google.android.material.navigation.NavigationView>
    </androidx.drawerlayout.widget.DrawerLayout>





</androidx.coordinatorlayout.widget.CoordinatorLayout>
Srikar Reddy
  • 3,650
  • 4
  • 36
  • 58
user113428
  • 61
  • 6
  • do you really need the `NestedScrollView` ? It could be your problem , at least I had the same... Is it possible to remove it? – Ilya Maier Apr 16 '20 at 18:39
  • else, just try this in your `RecyclerView` : `app:layout_behavior="@string/appbar_scrolling_view_behavior"` – Ilya Maier Apr 16 '20 at 18:40
  • Can you post the picture to get a visual representation of your UI? Can you tell us whether you are scrolling on the Recyclerview items or on the image? – Srikar Reddy Apr 16 '20 at 19:36

4 Answers4

0

You could try removing your NestedScrollView as it overlaps with RecyclerView and that's why it#s not scrolling.

Else you could insert that code in your RecyclerCode:

 app:layout_behavior="@string/appbar_scrolling_view_behavior"

A more detailed answer could be found here

Ilya Maier
  • 475
  • 3
  • 12
0

Try

recyclerView.setNestedScrollingEnabled(false);
0

I sloved it. this is Cover RecyclerView

    <!--menu-->
<androidx.drawerlayout.widget.DrawerLayout
    android:layout_width="match_parent"
    tools:openDrawer="end"
    android:layout_height="match_parent"
    android:id="@+id/drawer_layout">

So I replace it To :

<!--menu-->
<androidx.drawerlayout.widget.DrawerLayout
    android:layout_width="match_parent"
    tools:openDrawer="end"
    android:layout_height="match_parent"
    android:id="@+id/drawer_layout">

    <!--    RecyclerView-->

    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/recycler"
        android:layout_marginTop="250dp"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
    </androidx.recyclerview.widget.RecyclerView>
user113428
  • 61
  • 6
0

Please add android:fillViewport="true" in NestedScrollView Tag...
then add android:nestedScrollingEnabled="true" in RecyclerView Tag...

<androidx.core.widget.NestedScrollView
        android:layout_width="match_parent"
        android:layout_marginTop="250dp"
        android:layout_height="match_parent"
        android:fillViewport="true">
        <androidx.recyclerview.widget.RecyclerView
            android:id="@+id/recycler"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:nestedScrollingEnabled="true">
        </androidx.recyclerview.widget.RecyclerView>
    </androidx.core.widget.NestedScrollView>
Jaimil Patel
  • 1,301
  • 6
  • 13