6

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

János
  • 32,867
  • 38
  • 193
  • 353
  • Possible duplicate http://stackoverflow.com/questions/29929963/is-there-a-way-to-show-a-preview-of-a-recyclerviews-contents-in-the-android-stu – Oded Regev Sep 25 '16 at 14:33

3 Answers3

20

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

  android:orientation="horizontal"
  android:scrollbars="horizontal"
  app:layoutManager="LinearLayoutManager"
Christian D
  • 455
  • 6
  • 9
1

AFAIK, there is no such facility editor provide yet. although you can set the orientation of LinearLayoutManager Horizontal at runtime, this will fulfill your requirement.

LinearLayoutManager layoutManager
                = new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false);
Dilip
  • 2,271
  • 5
  • 32
  • 52
1

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.

Siddhesh Dighe
  • 2,894
  • 3
  • 16
  • 16