我发现了如何使用预览列表项
tools:listitem="@layout/my_item_layout"
然而,Android Studio 将 recyclerview 预览为垂直列表。有没有办法告诉 Android Studio 使用 LinearLayoutManager
以水平方式显示布局预览?
最佳答案
添加一个 LayoutManager 并设置水平方向。
这里是一个例子:
<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 - 在android studio中预览水平recyclerview,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35681433/