Reputation: 1
I want to result like this:
which can do horizontal-scrolling.
But in fact, like this below:
Which can't display all item and not horizontal-layout.
who can help me ? thanks. other way can reach my wanted result here?
Upvotes: -2
Views: 958
Reputation: 4108
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"
Upvotes: 0
Reputation: 2403
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.
Upvotes: 0