Android-RecyclerView GridLayout上的图像位于底部
这是我当前的Android-RecyclerView GridLayout上的图像位于底部,android,android-recyclerview,Android,Android Recyclerview,这是我当前的Gridlayout代码: image_list.setLayoutManager(new GridLayoutManager(this, 3, LinearLayoutManager.VERTICAL, true)); 当我这样做时,所有这些图像都排在底部,而不是顶部。反正我能修好这个?谢谢。将reverselayout设置为false //Like this image_list.setLayoutManager(new GridLayoutManager(this, 3,
Gridlayout
代码:
image_list.setLayoutManager(new GridLayoutManager(this, 3, LinearLayoutManager.VERTICAL, true));
当我这样做时,所有这些图像都排在底部,而不是顶部。反正我能修好这个?谢谢。将reverselayout设置为false
//Like this
image_list.setLayoutManager(new GridLayoutManager(this, 3, LinearLayoutManager.VERTICAL, false));
文件:
你必须将reverseLayout Boolean设置为false。我不明白你的意思。你能简单解释一下吗?把你的图像提取代码作为参考。我是通过FireBaseRecyclerAdapter进行的。如果我将其设置为false,gridlayout的最旧图片在顶部,而新图片在底部。无论如何,要解决这个问题?需要对数组列表进行排序才能实现。我正在从Firebase中提取图像,这是如何实现的?
/**
* @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);
}