Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to show RecyclerView preview in layout editor with horizontal orientation?

RecyclerView is shown with vertical orientation, and can not set this property, because orientation belongs to the LinearLayoutManager object. Any way to simulate HORIZONTAL layout?

Anyway the linearLayoutManager created in code is set to HORIZONTAL.

llm.setOrientation(LinearLayoutManager.HORIZONTAL);

enter image description here

like image 628
János Avatar asked Jun 29 '16 08:06

János


2 Answers

try to add these parameters to your RecyclerView inside your layout xml:

  android:orientation="horizontal"
  android:scrollbars="horizontal"
  app:layoutManager="LinearLayoutManager"
like image 62
Christian D Avatar answered Oct 02 '22 12:10

Christian D


RecyclerView won't show your actual data in the Editor Layout as the data you add in your RecyclerView is added Dynamically in your java code through Adapter and you implement a layout manager for your recyclerView in your java code and your Editor Layout displays the elements that are in your xml, so in your XML file its just a plain recyclerView which has no idea of what data is added in your Java implementation or what LayoutManager is to be implemented on it.

like image 35
Siddhesh Dighe Avatar answered Oct 02 '22 11:10

Siddhesh Dighe