I have an Android app using a recyclerView and a LinearLayoutManager. I was under the impression that changing the LinearLayoutManager to GridLayoutManager (see the commented line below and the following line) will simply give me a grid. But nothing changes and I still see the linear list, one item per row, and one column.
recyclerView = view.findViewById(R.id.item_setup_recycler_view);
recyclerView.setHasFixedSize(true);
//recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
recyclerView.setLayoutManager(new GridLayoutManager(getActivity(), 2));
adapter = new ItemSetupRecyclerViewAdapter(getActivity(), kids);
recyclerView.setAdapter(adapter);
Can someone please let me know if there are other areas I need to change before I see the grid?
Here is the xml for the recyclerView:
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/feed_recycle_view"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginBottom="8dp"
android:clipToPadding="false"
android:paddingBottom="74dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView8"
app:layout_constraintVertical_bias="0.0">
</androidx.recyclerview.widget.RecyclerView>
Thanks in advance