如何解决Android导航抽屉不滚动
我尝试使用抽屉布局和抽屉布局内的导航视图来实现导航抽屉。但是我的导航视图仅显示第一个屏幕上的元素,而不会向下滚动。
这是我正在使用的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填充导航视图,但没有一个使导航抽屉可滚动。
我在做什么错?请提供解决方案。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。