I'm trying to make a gridview that has only two rows. My intention is to make it look like a gallery with two rows, one above the other and with a horizontal scroll. I see that you can change the number of columns in the gridview, but can not find how to change the number of rows. I appreciate any help, and if not possible using with gridview also appreciate any ideas.
我正在尝试制作一个只有两行的gridview。我的目的是使它看起来像一个有两排的画廊,一个在另一个之上,并有一个水平卷轴。我看到您可以更改gridview中的列数,但无法找到如何更改行数。我感谢任何帮助,如果不可能使用gridview也欣赏任何想法。
2 个解决方案
#1
0
You can use RecycleView instead of GridView.
您可以使用RecycleView而不是GridView。
With RecyclerView you can make Horizontal and Vertical Grid Like Views.
使用RecyclerView,您可以制作水平和垂直网格视图。
With GridLayoutManager, you can set horizontal recyclerview with limited number of rows.
使用GridLayoutManager,您可以使用有限的行数设置水平回收视图。
https://developer.android.com/reference/android/support/v7/widget/GridLayoutManager.html
Refer this method in documentation,
在文档中引用此方法,
GridLayoutManager (Context context,
int spanCount,
int orientation,
boolean reverseLayout)
#2
0
yes,its possible to display fixed row of gridview with the help of fix height of your parent layout and also remove scrollview as parent GridView automatically maintaining scrollView.
是的,它可以在父布局的固定高度的帮助下显示固定的gridview行,并且还可以移除scrollview作为父GridView自动维护scrollView。
#1
0
You can use RecycleView instead of GridView.
您可以使用RecycleView而不是GridView。
With RecyclerView you can make Horizontal and Vertical Grid Like Views.
使用RecyclerView,您可以制作水平和垂直网格视图。
With GridLayoutManager, you can set horizontal recyclerview with limited number of rows.
使用GridLayoutManager,您可以使用有限的行数设置水平回收视图。
https://developer.android.com/reference/android/support/v7/widget/GridLayoutManager.html
Refer this method in documentation,
在文档中引用此方法,
GridLayoutManager (Context context,
int spanCount,
int orientation,
boolean reverseLayout)
#2
0
yes,its possible to display fixed row of gridview with the help of fix height of your parent layout and also remove scrollview as parent GridView automatically maintaining scrollView.
是的,它可以在父布局的固定高度的帮助下显示固定的gridview行,并且还可以移除scrollview作为父GridView自动维护scrollView。