【问题标题】:Android - Material Design - NavigationView - How to put vertical scroll?Android - Material Design - NavigationView - 如何放置垂直滚动?
【发布时间】:2015-08-29 17:04:12
【问题描述】:

我正在使用带有compile 'com.android.support:design:22.2.1' 的 NavigationView 好吧,一切都很好,除非它没有垂直滚动 如何通过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>

【问题讨论】:

  • 我相信这是不可能的。
  • Gmail 和其他应用在菜单抽屉上有垂直滚动
  • 也许他们没有使用最近才使用的 NavigationView

标签: android scrollview material-design navigationview


【解决方案1】:

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

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

【讨论】:

    【解决方案2】:

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

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

    【讨论】:

      【解决方案3】:

      android.support.design.widget.NavigationView 中尝试android:nestedScrollingEnabled="true"

      【讨论】:

      • 什么都没有发生,是不是漏掉了什么?
      • @DouglasFornaro 尝试将您的菜单放在滚动视图中
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-04-05
      • 2019-08-08
      • 1970-01-01
      • 1970-01-01
      • 2013-03-12
      • 1970-01-01
      相关资源
      最近更新 更多