ScrollView 不闪烁。缓慢滚动

ScrollView not flinging. Scrolling slowly

我有以下布局:

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_marginTop="?android:attr/actionBarSize"
    android:fillViewport="true">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">

        <LinearLayout
            android:id="@+id/datatransfer_measure_list_layout_no_data"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">

            <TextView
                android:id="@+id/datatransfer_measure_list_textview_no_data"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="20dp"
                android:layout_marginEnd="40dp"
                android:layout_marginStart="40dp"
                android:layout_marginTop="20dp"
                android:gravity="center"
                android:padding="5dp"
                android:text="@string/measure_data_empty"
                android:textColor="@color/textcolorprimary"
                android:textSize="18sp" />

            <View
                android:layout_width="match_parent"
                android:layout_height="1dp"
                android:layout_gravity="center"
                android:layout_marginBottom="20dp"
                android:layout_marginEnd="20dp"
                android:layout_marginStart="20dp"
                android:background="@android:color/darker_gray"
                android:importantForAccessibility="no" />
        </LinearLayout>

        <android.support.v7.widget.RecyclerView
            android:id="@+id/datatransfer_measure_list_row_parent"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="15dp"
            android:clipToPadding="false"
            android:importantForAccessibility="no"
            android:paddingBottom="5dp"
            android:textColor="@color/textcolorprimary" />

        <Button
            android:id="@+id/datatransfer_measure_list_button_send"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_marginBottom="10dp"
            android:layout_marginEnd="40dp"
            android:layout_marginStart="40dp"
            android:background="@drawable/custom_button_ok"
            android:gravity="center"
            android:padding="10dp"
            android:text="@string/common_save"
            android:textColor="@drawable/custom_button_positive_text_color"
            android:textSize="20sp" />

        <Button
            android:id="@+id/datatransfer_measure_list_button_reset"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_marginBottom="20dp"
            android:layout_marginEnd="40dp"
            android:layout_marginStart="40dp"
            android:background="@drawable/custom_button_cancel"
            android:gravity="center"
            android:padding="10dp"
            android:text="@string/common_cancel"
            android:textColor="@drawable/custom_button_negative_text_color"
            android:textSize="20sp" />
    </LinearLayout>
</ScrollView>

这个布局我基本上是三部分。首先是一个仅包含文本视图的布局,用于在未设置数据时显示。有数据就看不见了。

第二部分是我的 recyclerview,它仅在设置某些数据时显示。

最后一部分是两个按钮。我的这个布局有问题吗? 滚动真的很慢。我不是说落后或类似的东西。我只能滚动一小部分。它不像我的其他 scrollviews,我可以快速移动视图以便它自动滚动。我不知道这个布局有什么不同,也不知道为什么滚动视图在这里的工作方式与我的其他布局不同。是否有东西阻挡了 scrollview fling 或类似的东西?

您的 RecyclerviewScrollView 发生冲突,这就是滚动不流畅的原因。

尝试禁用 recyclerview 的滚动。

RecyclerView recyclerView = (RecyclerView)findViewById(R.id.datatransfer_measure_list_row_parent);
recyclerView.setNestedScrollingEnabled(false)