I found out how to preview a list item by using
tools:listitem="@layout/my_item_layout"
Android studio however is previewing the recyclerview as a vertical list. Is there a way to tell Android Studio to display the layout preview in a horizontal fashion using LinearLayoutManager
?
Just right-click the RecyclerView in the layout editor and choose "Preview list content".
Add a LayoutManager and set a horizontal orientation.
Here an example:
<android.support.v7.widget.RecyclerView android:id="@+id/homesRecyclerView" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" app:layoutManager="android.support.v7.widget.LinearLayoutManager" android:layout_centerVertical="true" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With