RecyclerViews
私は上下に一緒にスクロールしたい2つがあります。また、そのうちの1つは水平方向にスクロールできなければなりません。私がこれを達成するためにしたのは、ScrollViews
です。目的の効果を得るために、私はnestedScrollingEnabled
を無効にしました。それらは非常にスムーズに一緒にスクロールしますが、私は今異なる問題があります:RecyclerViews
は、ビューをリサイクルするのではなく、一度にすべてのビューをロードします。これはUIに深刻な影響を与えます。 RVを表示したり、データセットを変更したりするたびに、フレームが100フレーム以上スキップされています。どのように私はこれにもっと近づくことができる?2つのRecyclerViewが同期してスムーズにスクロールしますが、非常にゆっくりと読み込まれます
ここにXMLがあります。プログラムで設定されているので、幅と高さの値は気にしないでください。
<ScrollView
android:id="@+id/verticalScrollView"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/headerConstraintLayout"
app:layout_constraintVertical_bias="1.0">
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<include
layout="@layout/first_recyclerview"
android:layout_width="100dp"
android:layout_height="wrap_content"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintLeft_toLeftOf="parent" />
<HorizontalScrollView
android:id="@+id/horizontalScrollView"
android:layout_width="40dp"
android:layout_height="0dp"
android:layout_marginLeft="100dp"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent">
<include
layout="@layout/second_recyclerview"
android:layout_width="100dp"
android:layout_height="wrap_content" />
</HorizontalScrollView>
</android.support.constraint.ConstraintLayout>
</ScrollView>