Android导航抽屉不滚动

时间:2020-11-12 19:09:45

标签: android scroll scrollview navigation-drawer

我尝试使用抽屉布局和抽屉布局内的导航视图来实现导航抽屉。但是我的导航视图仅显示第一个屏幕上的元素,而不会向下滚动。

这是我正在使用的XML:

<?xml version="1.0" encoding="utf-8"?>
<androidx.drawerlayout.widget.DrawerLayout
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:openDrawer="start"
    >

    <com.google.android.material.navigation.NavigationView
        android:id="@+id/nav_view"
        android:layout_height="match_parent"
        android:layout_width="wrap_content"
        app:itemTextColor="#FFFFFF"
        app:itemIconTint="#FFFFFF"
        android:layout_gravity="end"
        android:paddingBottom="0dp"
        android:paddingTop="24dp"
        android:background="#1F262F"
        app:menu="@menu/menu_drawer"
        >
    </com.google.android.material.navigation.NavigationView>

    <include
        layout="@layout/app_bar_main"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
</androidx.drawerlayout.widget.DrawerLayout>

我尝试在导航视图外部使用滚动条,也尝试使用listview填充导航视图,但没有一个使导航抽屉可滚动。

我在做什么错?请提供解决方案。

0 个答案:

没有答案