Spotz
Spotz

Reputation: 113

Android- Images on RecyclerView GridLayout are at the bottom

This is my current code for Gridlayout:

image_list.setLayoutManager(new GridLayoutManager(this, 3, LinearLayoutManager.VERTICAL, true));

When I do this, all this images are lined at the bottom, not the top. Anyway I could fix this? Thanks.

Upvotes: 1

Views: 191

Answers (1)

Abhishek
Abhishek

Reputation: 3398

Set reverselayout to false

 //Like this
 image_list.setLayoutManager(new GridLayoutManager(this, 3, LinearLayoutManager.VERTICAL, false));

Documentation :

 /**
 * @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);
}

Upvotes: 2

Related Questions