Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Design Layout ListItem RecyclerView Horizontal

I am using the tools:listitem attribute to show my views in the design layout with a recyclerview. Problem is, they always show up in a vertical list. Is there a way to have the Design Layout Editor display them horizontally?

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">

<android.support.v7.widget.RecyclerView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:listitem="@android:layout/simple_list_item_checked"/>

enter image description here

I want the above image, displayed horizontally. IN THE DESIGN VIEW. NOT in the application itself, I know how to do that.

like image 865
easycheese Avatar asked Sep 05 '25 03:09

easycheese


1 Answers

Complete example that works:

<android.support.v7.widget.RecyclerView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:orientation="horizontal"
    tools:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
    tools:listitem="@layout/view_item" />

PS: you can replace androidx.recyclerview.widget.LinearLayoutManager by android.support.v7.widget.LinearLayoutManager if you don't use AndroidX.

like image 130
Kevin Robatel Avatar answered Sep 07 '25 19:09

Kevin Robatel