jmartinesp/SpannedGridLayoutManager

What if the item size is not int?

Closed this issue · 2 comments

Hi,

Thanks for your wonderful code. I have a question about it, say I have a vertical list, the span count is 4. What if I want the item width is 1, and the height is 1.5?

I'm looking into this, but as a workaround you could set the LayoutManager SpanSize to 8 and double both width and height so they are both integers.

Floats can't be used with LayoutParams.width and .height as it does now, so the API would need to change in order to use them.

@Arasthel Thanks for your response. The workaround you mentioned does work good in some situation, but the aspect ration could be any number, say 1 : 2.34566789 instead of 1 : 1.5, in this situation, convert it to integer may not be a good idea.

I'm wondering if this's a proper solution:
Suppose the list is in vertical, then the width keeps the meaning(how many columns the item take), width should be some thing great than 0 but smaller than or equal to spanCount. But the height has no relation with the spanCount, it just means the item height in pixel. In this way, the item can in any aspect ration. If the list is in horizontal, we just keep the height related with spanCount and make the width in pixel.