1

I have a GridView with multiple View types. For some reason the height of the top row always matches the shortest item, so taller items are truncated at the bottom.

Is there a way to tell my GridView to make sure every item fits in the row? Do I have any control over the height of individual rows? How does GridView decide how tall a row should be?

P.S. I didn't post a code sample because I'm pretty sure this problem isn't specific to my code. In fact I think it may be a bug in GridView since it only happens in the first row.

Barry Fruitman
  • 12,316
  • 13
  • 72
  • 135
  • 1
    Are all of the View layout heights dynamic, or just different? Could you force all View types to have the same height and then rely on the gravity of layouts within the fixed height View? – puj Mar 16 '15 at 22:16
  • They are not dynamic. I could force them to the same height but that would be a lot more difficult. The tallest View height is "wrap_content" so I don't know the exact height until runtime, making it a lot trickier to resize the shorter Views. It seems to me that GridView could adjust it's height more intelligently than it does. – Barry Fruitman Mar 16 '15 at 22:59

2 Answers2

1

It seems like the GridView uses the first child to measure the height of the row

This might be your best bet.. GridView rows overlapping: how to make row height fit the tallest item?

Community
  • 1
  • 1
puj
  • 770
  • 5
  • 9
0

I've done more research into this. The short answer is, if you want to be absolutely certain that the row will match the height of the tallest item, you need to make every item the same height, or set minHeight to the height of the tallest item. :(

Barry Fruitman
  • 12,316
  • 13
  • 72
  • 135