這是我Gridlayout
當前的代碼:Android-圖像處於底部
image_list.setLayoutManager(new GridLayoutManager(this, 3, LinearLayoutManager.VERTICAL, true));
當我這樣做,所有這些圖像在底部,而不是頂部襯裏。無論如何我可以解決這個問題?謝謝。
這是我Gridlayout
當前的代碼:Android-圖像處於底部
image_list.setLayoutManager(new GridLayoutManager(this, 3, LinearLayoutManager.VERTICAL, true));
當我這樣做,所有這些圖像在底部,而不是頂部襯裏。無論如何我可以解決這個問題?謝謝。
設置reverselayout假
//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);
}
你必須reverseLayout布爾設置爲false。 – Abhishek
我沒有得到你,你可以簡單解釋一下。? –
把你的圖像拉代碼參考。 – Abhishek