我需要像滚动视图水平视图的游戏商店,但我无法实现它.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" > <horizontalscrollview android:id="@+id/horizontalscrollview1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:fillViewport="true" android:scrollbars="horizontal" > <GridView android:layout_width="500dp" android:layout_height="400dp" android:id="@+id/gridview" android:columnWidth="300dp" android:numColumns="3" android:horizontalSpacing="10dp" android:scrollbars="horizontal"> </GridView> </horizontalscrollview> </RelativeLayout>
我想在我的应用程序中使用这种类型的View请查看截图:
解决方法
你可以使用RecylerView.
linearlayoutmanager linearlayoutmanager = new linearlayoutmanager(getActivity()); linearlayoutmanager.setorientation(linearlayoutmanager.HORIZONTAL); RecylerView.setLayoutManager(linearlayoutmanager);