Instead of solving this by using the GridLayoutManager options I added GridLayout in the xml.
<GridLayout
android:id="@+id/grid_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:columnCount="2"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/text_panel">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/left_list"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@id/grid_container" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/right_list"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@id/grid_container" />
</GridLayout>
Then I split the parent ArrayList into a right and left ArrayList in the OnBindViewHolder(). I end up with two child RecyclerViews, but it works and
I have fine control over the appearance.
ArrayList<Breaker> leftList = new ArrayList<>();
ArrayList<Breaker> rightList = new ArrayList<>();
for(int i = 0; i < p.getCount(); i++) {
if (p.getB(i).getType() % 2 == 0) {
leftList.add(p.getB(i));
} else {
rightList.add(p.getB(i));
}
}
LinearLayoutManager leftLayout = new LinearLayoutManager(h.leftBView.getContext());
h.leftBView.setLayoutManager(leftLayout);
MultiAdapter leftBAdapter = new MultiBAdapter(leftList,
h.leftBView.getContext());
h.leftBView.setAdapter(leftBAdapter);
LinearLayoutManager rightLayout = new LinearLayoutManager(h.rightBView.getContext());
h.rightBView.setLayoutManager(rightLayout);
MultiBAdapter rightBAdapter = new MultiBAdapter(rightList,
h.rightBView.getContext());
h.rightBView.setAdapter(rightBAdapter);