私はAndroidアプリケーションを開発しています。画面の 1 つに次のような UI があります: Mockup-UI
つまり、いくつかの列があり、列の幅も固定されているため、水平方向にスクロールする必要があるかもしれません。各列には異なる項目数があり、垂直方向にスクロールするとすべての列がスクロールされます。そのため、この UI を実装する方法がわかりません。私は解決策を試しました: 2 つのスクロールビューでいくつかの大きな recyclerview を作成し、それらのサイズをすべて測定します:
<LinearLayout
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:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<HorizontalScrollView
android:id="@+id/horizontalScrollView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="true"
android:scrollbars="none">
<LinearLayout
android:id="@+id/horizontalContainer"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal">
</LinearLayout>
</HorizontalScrollView>
</ScrollView>
</LinearLayout>
しかし、recyclerview が大きすぎると、ビューが再利用されず、すべてのサイズを測定するパフォーマンスが非常に悪くなります。そこで、カスタム レイアウト マネージャーでこのようなリサイクラー ビューを作成できることがわかりましたが、実装方法がわかりません。FixedGridLayoutManagerと StaggeredGridLayoutManager が混在している可能性があります。