0

I have a layout using a Recyclerview in a ConstaintLayout as follows

<androidx.constraintlayout.widget.ConstraintLayout  xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    tools:context=".ui.user_list.UserListSelectionBottomSheetDialogFragment">

<!--<com.google.android.material.appbar.MaterialToolbar
    android:id="@+id/user_list_selection_toolbar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:layout_constraintTop_toTopOf="parent"
    style="@style/Widget.MaterialComponents.Toolbar.Surface" />

<com.google.android.material.divider.MaterialDivider
    android:id="@+id/user_list_selection_toolbar_divider"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:layout_constraintTop_toBottomOf="@id/user_list_selection_toolbar" /> -->

<androidx.recyclerview.widget.RecyclerView
    android:id="@+id/user_list_selection_list"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_constraintTop_toTopOf="parent"
    app:layout_constraintBottom_toBottomOf="parent"
    tools:listitem="@layout/item_user_list" />
</androidx.constraintlayout.widget.ConstraintLayout>

However, the recyclerview seems to be showing up horizontally instead of vertically and is not rendering the items (I changed the item background color to green)

enter image description here

But if I change the parent layout to a LinearLayout, it shows up fine. I see this is an existing issue such as here but is there an explanation as to why? Or is it just something to accept?

Cheticamp
  • 56,919
  • 9
  • 74
  • 121
Oliver Song
  • 83
  • 1
  • 5

0 Answers0