Questions tagged [gridlayoutmanager]

A RecyclerView.LayoutManager implementations that lays out items in a grid.

A RecyclerView.LayoutManager implementations that lays out items in a grid. More info on the docs: https://developer.android.com/reference/android/support/v7/widget/GridLayoutManager.html

403 questions
26
votes
2 answers

Different (dynamic) items height in GridLayoutManager

I have a RecyclerView and GridLayoutManager with 2 columns. How can I force LayoutManager to be according with template on the first screenshot? Now I have result as on the 2th screenshot. Need result: Current result:
BlizzedRu
  • 357
  • 1
  • 3
  • 10
24
votes
2 answers

How to implement horizontal gridlayoutmanager

How to implement horizontal gridlayoutmanager with recyclerview. Fixed row count. and horizontal scroll. Like this... gridLayoutManager = new GridLayoutManager(getContext(), 1, GridLayoutManager.HORIZONTAL, false); …
haha
  • 451
  • 1
  • 4
  • 10
24
votes
2 answers

Items are not the same width when using RecyclerView GridLayoutManager to make column spacing by ItemDecoration

I'm trying to use RecyclerView and GridLayoutManager to make a 3 columns grid, and I use ItemDecoration to make column spacing, now the problem is the item's width in third column is smaller than the item in first and second column! See the screen…
Riki
  • 2,774
  • 1
  • 24
  • 38
21
votes
4 answers

center items horizontally in RecyclerView(using GridLayoutManager)

I'm trying to center all my items horizontally for each row in RecyclerView I tried many things: RelativeLayout as a parent, then use layout_centerInParent, use the basic android:layout_gravity="center", try to add some space element,using weights…
19
votes
5 answers

Recyclerview binds all views at the same time

I have a vertical recyclerview (with a GridLayoutManager) inside another recyclerview (with LinearLayoutManager). The problem I am facing right now is that, the inner recyclerview (with GridLayoutManager) binds all of it's items at the same time,…
17
votes
2 answers

Center Horizontal last row using span Recycler GridLayoutManager

I am trying to make items of the last row center horizontal in recycler view. I am using GridLayoutManager in order to achieve the functionality. Using setSpanSizeLookup, I want to adjust span size for the last row as pointed by posts on SO, but…
NightFury
  • 13,436
  • 6
  • 71
  • 120
17
votes
1 answer

GridLayoutManager - column width wrap its own largest child

I got a RecyclerView inside an HorizontalScrollView and I want it to use a GridLayoutManager. This is ok but one thing still bother me, the width of every columns are the same (based on the largest cell width I suppose?). Isn't it possible to wrap…
17
votes
2 answers

Spacing Issue while creating bus layout in recycler view Gridlayout manager

I'm using recycler view with GirdLayout Manager for creating bus layout. My problem is with spacing, I'm populating data according to row column. This is how I'm getting layout: This is how I want my layout to be: I want the item at row 3 and…
17
votes
2 answers

Drag and Drop view outside of Recyclerview

What I want to achieve: I want to have a view inside a scrollable layout (Recyclerview with GridlayoutManager) with tiles (Views) in it. Dragging and dropping an item inside of the RecyclerView should adjust the position of the icon and swap with…
Eve
  • 1,153
  • 1
  • 15
  • 34
16
votes
4 answers

Changing number of columns in RecyclerView gridlayout

I am trying to change the number of columns that appear in the recycler view (grid layout) based on the display size. However I couldn't figure out a proper way of achieving it. At the moment I am using treeViewObserver to change the number of…
Umer Farooq
  • 7,356
  • 7
  • 42
  • 67
15
votes
3 answers

Recycler View with multiple rows and columns - AutoFit like Flow Layout [Android]

I'm in a challenge to build a layout like this: My first insight was to use a RecyclerView with an adapter that can deal with each item and inflate its layout. So far, not so good. I got this layout so far: I can felling that I'm almost there, but…
14
votes
3 answers

RecyclerView's GridLayoutManager dynamic span count

I am using following code dynamically change span count. val layoutManager = GridLayoutManager(this, 3) layoutManager.spanSizeLookup = object : GridLayoutManager.SpanSizeLookup() { override fun getSpanSize(position: Int): Int { when…
Gunaseelan
  • 14,415
  • 11
  • 80
  • 128
13
votes
2 answers

RecyclerView grid layout manager doesn't center items

I inherited some big project with a lot of legacy code and now I'm facing some weird stuff.. I need to make this screen have recyclerview with grid layout manager, 2 columns. This is what I get. Is there a way to center those icons in the middle of…
joe
  • 1,341
  • 4
  • 21
  • 32
13
votes
3 answers

RecyclerView - offscreen items skipping first layout pass

I am having trouble with one of my adapters. I have a selection of images which I display in a grid like the following: This works well when I have a single screen worth of items and they all show up fine. The problem appears when there are more…
13
votes
4 answers

GridLayoutManager spanSizeLookup bug

I am having an issue with GridLayoutManger setSpanSizeLookup, when an orientation of activity changes, I am changing the span count while checking if the specific position is some sort of type, this works perfectly on orientation change, my only…
Kosh
  • 6,140
  • 3
  • 36
  • 67
1
2
3
26 27