我想结果是这样的:RecyclerView在NestedScrollView与水平scolling
它可以做水平滚动。
但事实上,这样的下面:
不能显示所有项目,而不是横向布局。
谁能帮帮我?谢谢。其他方式可以达到我想要的结果吗?
我想结果是这样的:RecyclerView在NestedScrollView与水平scolling
它可以做水平滚动。
但事实上,这样的下面:
不能显示所有项目,而不是横向布局。
谁能帮帮我?谢谢。其他方式可以达到我想要的结果吗?
您需要将布局管理器添加到RecylerView。
LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity(), LinearLayoutManager.HORIZONTAL, false);
recylcerView.setLayoutManager(layoutManager);
这将使RecylerView水平。
我设置了LinearLayoutManager.HORIZONTAL,但RecyclerView在NestedScrollView显示垂直,不是水平 – Seven
要将recyclerView设置为水平scrollView,您可以使用LinearLayoutManager。默认情况下它会设置垂直滚动行为。
LinearLayoutManager layout = new LinearLayoutManager(getActivity(), 0, false);//0 Horizontal , 1 vertical
recyclerView.setLayoutManager(layout);
在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" />
在NestedScrollView添加此
android:fillViewport="true"
没有效果,但显示垂直 – Seven
看看这里:http://stackoverflow.com/editing-help #images,然后编辑或提出正确放置图像的新问题。如果一切正常,请务必在预览时检查。 – emiliopedrollo