这是我目前的Gridlayout
代码:
image_list.setLayoutManager(new GridLayoutManager(this, 3, LinearLayoutManager.VERTICAL, true));
当我这样做时,所有这些图像都在底部排列,而不是顶部。无论如何我可以解决这个问题?感谢。
答案 0 :(得分:2)
将reverselayout设置为false
//Like this
image_list.setLayoutManager(new GridLayoutManager(this, 3, LinearLayoutManager.VERTICAL, false));
文档:
/**
* @param context Current context, will be used to access resources.
* @param spanCount The number of columns or rows in the grid
* @param orientation Layout orientation. Should be {@link #HORIZONTAL} or {@link
* #VERTICAL}.
* @param reverseLayout When set to true, layouts from end to start.
*/
public GridLayoutManager(Context context, int spanCount, int orientation,
boolean reverseLayout) {
super(context, orientation, reverseLayout);
setSpanCount(spanCount);
}