在Android Studio中预览卧式RecyclerView [英] Previewing horizontal recyclerview in android studio

查看:143
本文介绍了在Android Studio中预览卧式RecyclerView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我了解了如何使用

tools:listitem="@layout/my_item_layout"

但是,Android Studio正在将recyclerview预览为垂直列表.有没有办法告诉Android Studio使用LinearLayoutManager以水平方式显示布局预览?

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?

推荐答案

添加LayoutManager并设置水平方向.

Add a LayoutManager and set a horizontal orientation.

这里有个例子:

<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"
    />

这篇关于在Android Studio中预览卧式RecyclerView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆