2

我正在使用 NavigationViewcompile 'com.android.support:design:22.2.1' 好吧,除非它没有垂直滚动,否则一切都很好 我如何通过 xml 设置它?

xml:

<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout 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:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true">

    <!-- The main content view -->
    <foo>
    </foo>

    <!-- The navigation drawer -->
    <android.support.design.widget.NavigationView
        android:id="@+id/navigation_view"
        style="@style/NavigationViewTheme"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:fitsSystemWindows="true"
        app:headerLayout="@layout/navigation_drawer_header"
        app:menu="@menu/navigation_drawer_menu" />
</android.support.v4.widget.DrawerLayout>
4

3 回答 3

1

我找到了一个解决方案,这似乎是设计库上的一个错误。更新库解决了我的问题

compile 'com.android.support:design:23.0.1'
于 2015-09-26T17:53:32.477 回答
1

在您的活动 java 文件中使用此代码

navigationView.bringToFront();
navigationView.setVerticalScrollBarEnabled(true);
于 2019-09-03T22:20:00.593 回答
0

试穿android:nestedScrollingEnabled="true"_android.support.design.widget.NavigationView

于 2015-08-29T17:55:01.897 回答