如何添加我的根滚动视图惯性效果或为我的案例更改此代码

How add my root Scroll View inertia effect or change this code for my case

再次,我呼吁你的智慧,因为我无法解决我的问题。我有一个带两个 listView 的抽屉。我需要所有视图的一般滚动,我可以做到这一点,但没有惯性效应。我在哭,因为我在这个问题上迷失了三天。我正在尝试通过 xml 中的菜单和 NavigationDrawer 来解决这个问题,但这没有帮助。我正在尝试将我的列表视图放在抽屉中的一个大根列表视图中,但这很令人毛骨悚然。请帮我。我知道,带有 listView 的 ScrollView 是不好的解决方案,但我能做什么?这是我的代码。

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


    <include layout="@layout/toolbar"

        android:layout_height="match_parent"
        android:layout_width="match_parent"
        android:scrollbars="none">

    </include>

    <LinearLayout
        android:id="@+id/drawer_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:background="@drawable/bg_gradient_vertical"
        android:orientation="vertical"
        android:paddingBottom="@dimen/activity_common_margin"
        android:paddingEnd="0dp"
        android:paddingLeft="@dimen/activity_common_margin"
        android:paddingRight="0dp"
        android:paddingStart="@dimen/activity_common_margin"
        android:paddingTop="@dimen/activity_common_margin">

        <TextView
            style="@style/drawerHeading"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/label_cabinet_list_view"
            android:text="@string/drawer_personal_cabinet_header" />

        <View
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:background="@color/colorPrimary" />

        <ListView
            android:id="@+id/cabinet_list_view"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:scrollbars="none"
            android:layout_marginBottom="@dimen/activity_min_margin"
            android:layout_marginLeft="@dimen/activity_common_margin"
            android:layout_marginStart="@dimen/activity_common_margin"
            android:layout_marginTop="@dimen/activity_min_margin"
            android:divider="@color/colorAccentLight"
            android:dividerHeight="1dp"
            />

        <TextView
            style="@style/drawerHeading"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/drawer_menu_header" />

        <View
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:background="@color/colorPrimary" />

        <ListView
            android:id="@+id/menu_list_view"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="@dimen/activity_min_margin"
            android:layout_marginLeft="@dimen/activity_common_margin"
            android:layout_marginStart="@dimen/activity_common_margin"
            android:layout_marginTop="@dimen/activity_min_margin"
            android:scrollbars="none"
            android:divider="@color/colorAccentLight"
            android:dividerHeight="1dp" />



    </LinearLayout>



</android.support.v4.widget.DrawerLayout>
  • I'm found answer for my question. As my drawer doesn't contain much view-elements, I am a refused from ListView and RecycleView, and just posted them in ScrollView.Of course, I do not think, that this is a best solution, but other I not found.
 <?xml version="1.0" encoding="utf-8"?>
        <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
            xmlns:tools="http://schemas.android.com/tools"
            xmlns:app="http://schemas.android.com/apk/res-auto"
            android:id="@+id/drawer_layout"
            android:layout_width="match_parent"
            app:layout_behavior="@string/appbar_scrolling_view_behavior"
            android:layout_height="match_parent"
            android:fitsSystemWindows="true"
            tools:openDrawer="start">


            <include layout="@layout/toolbar"

                android:layout_height="match_parent"
                android:layout_width="match_parent"
                android:scrollbars="none">

            </include>

            <ScrollView
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:layout_gravity="start"
                android:scrollbars="none"
                android:id="@+id/scroll_drawer">

                <include layout="@layout/content_main"
                    android:layout_height="wrap_content"
                    android:layout_width="wrap_content">

                </include>

            </ScrollView>


        </android.support.v4.widget.DrawerLayout>