Skip to content
This repository has been archived by the owner on Mar 26, 2019. It is now read-only.

Is there a way to force line height ? #18

Open
prouland opened this issue Apr 12, 2018 · 3 comments
Open

Is there a way to force line height ? #18

prouland opened this issue Apr 12, 2018 · 3 comments

Comments

@prouland
Copy link

prouland commented Apr 12, 2018

Hello here.

I tried to force the line height in the case of a vertical spanned grid recycler view. On creating the ViewHolder, I set a new SpanLayoutParams with a computed height (here we try to have a specific number of line matching the recycler height).

But items are drawn with a height matching the width of a one-span-sized item.

Is there a way to achieve this with this SpannedGridLayoutManager ?

Thanks by advance.

Edit: just to know, the same methos of forcing items line height works fine with a classic GridLayoutManager.

@ksi3321
Copy link

ksi3321 commented Jun 11, 2018

Any updates on this?

@DennyWeinberg
Copy link

Same here. I have RV items with different layout files and different heights. But the height always seems to be the width of a column!?

@jmartinesp
Copy link
Owner

The issue with allowing custom heights - besides making the layouting algorithm more complex - is again the ordering used by the layout manager and failing at the problem it's trying to solve: placing all the items in the RV leaving as few gaps as possible.

One example would be this:

image

As the 3rd item is slightly taller than the rest of its row, it will affect all items below it and leave those 2 gaps there, that will probably never be filled. The more the items differ in width and heights, the more gaps will appear and the ordering will be affected.

As @prouland suggested, to prevent this the line or row height could be set to custom heights, instead of the items. Again, this would make the algorithm a lot more complex and require a big rewrite, which I can't do at the moment as I don't have the time.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants