-2

I want to result like this:

enter image description here

which can do horizontal-scrolling.

But in fact, like this below:

enter image description here

Which can't display all item and not horizontal-layout.

who can help me ? thanks. other way can reach my wanted result here?

USER9561
  • 1,084
  • 3
  • 15
  • 41
Seven
  • 1
  • 1
  • Take a look here: http://stackoverflow.com/editing-help#images , then edit or make a new question with images properly placed into it. Make sure to check at preview if everything is fine. – emiliopedrollo Sep 27 '16 at 02:40

2 Answers2

0

You need to add Layout manager to RecylerView.

    LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity(), LinearLayoutManager.HORIZONTAL, false);
    recylcerView.setLayoutManager(layoutManager);

This will make the RecylerView horizontal.

Sanjeet
  • 2,385
  • 1
  • 13
  • 22
  • I set the LinearLayoutManager.HORIZONTAL but RecyclerView in NestedScrollView display vertical,not horizontal – Seven Oct 09 '16 at 01:34
0

To set recyclerView as horizontal scrollView you can use LinearLayoutManager. by default it sets vertical scroll behaviour.

LinearLayoutManager layout = new LinearLayoutManager(getActivity(), LinearLayoutManager.HORIZONTAL, false);//0 Horizontal , 1 vertical
recyclerView.setLayoutManager(layout);

in layout.xml

<android.support.v7.widget.RecyclerView
    android:id="@+id/yourRecyclerView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@id/layout_past_round_header"
    android:layout_centerInParent="true"
    android:overScrollMode="never" />

in your NestedScrollView add this

android:fillViewport="true"
Komal12
  • 3,340
  • 4
  • 16
  • 25
Abdul Rizwan
  • 3,904
  • 32
  • 31