Ich habe eine Navigationsleiste erstellt und im Hauptinhalt der Navigationsleiste habe ich einen RecyclerView, aber es scrollt nicht. Anfangs habe ich RecyclerView ohne NestedScrollView gesetzt, aber das hat nicht funktioniert, also habe ich versucht, es in NestedScrollView zu setzen, aber letzteres hat auch nicht funktioniert.Recycler View scrollt nicht in der Navigationsleiste
Meine Navigationsleiste XML ist:
<RelativeLayout
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"
tools:context="com.roushan.assignment1.NavDrawerActivity">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/nav_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/nav_toolbar_color"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</android.support.design.widget.AppBarLayout>
<!-- MAIN CONTENT OF NAVIGATION DRAWER ACTIVITY -->
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="vertical">
</android.support.v7.widget.RecyclerView>
</android.support.v4.widget.NestedScrollView>
<android.support.v4.widget.DrawerLayout
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="56dp"
tools:openDrawer="start">
<android.support.design.widget.NavigationView
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:headerLayout="@layout/nav_drawer_header"
app:menu="@menu/activity_nav_drawer_drawer" >
</android.support.design.widget.NavigationView>
</android.support.v4.widget.DrawerLayout>
</RelativeLayout>
Der Hauptinhalt geht in das '', vor dem ''. Außerdem benötigen Sie nicht notwendigerweise das 'NestedScrollView'. –
Das hat funktioniert .. Vielen Dank .. –
Kein Problem. Bitte [akzeptieren Sie die Antwort unten] (http://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work), wenn es Ihr Problem gelöst hat, indem Sie das Häkchen unter den Pfeilen ankreuzen. Prost! –