Android - Material Design - NavigationView - How to put vertical scroll?

狂风中的少年 提交于 2019-12-08 01:36:52

问题


i'm using NavigationView with compile 'com.android.support:design:22.2.1' Well, everything is good unless it hasn't vertical scroll How do I set it via 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>

回答1:


I found a solution for this, it seems to be a bug on design library. Updating the library solved my problem

compile 'com.android.support:design:23.0.1'



回答2:


try android:nestedScrollingEnabled="true" in android.support.design.widget.NavigationView




回答3:


Use this code in your activity java file

navigationView.bringToFront();
navigationView.setVerticalScrollBarEnabled(true);


来源:https://stackoverflow.com/questions/32288620/android-material-design-navigationview-how-to-put-vertical-scroll

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!