title: GridView rows overlapping: how to make row height fit the tallest item?
body: <p>Like <a href="https://stackoverflow.com/questions/2375962/gridview-row-height">this previous person</a>, I have unwanted overlap between GridView items:</p>
  
  <p><img src="https://i.stack.imgur.com/gR4bR.png" width="533" height="342" alt="GridView items overlapping"/></p>
  
  <p>Notice the text, in every column except the rightmost one.</p>
  
  <p>Where I differ from that previous question is that I <strong>don't want a constant row height</strong>. I want the row height to vary to <strong>accommodate the tallest content</strong> in each row, for efficient use of screen space.</p>
  
  <p>Looking at the <a href="https://github.com/CyanogenMod/android_frameworks_base/blob/gingerbread/core/java/android/widget/GridView.java" rel="noreferrer">source for GridView</a> (not the authoritative copy, but kernel.org is still down), we can see in fillDown() and makeRow() that the last View seen is the "reference view": the row's height is set from the height of that View, not from the tallest one. <strong>This explains why the rightmost column is ok.</strong> Unfortunately, GridView is not well set-up for me to fix this by inheritance. All the relevant fields and methods are private.</p>
  
  <p>So, before I take the well-worn bloaty path of "clone and own", <strong>is there a trick I'm missing here?</strong> I could use a TableLayout, but that would require me to implement <code>numColumns="auto_fit"</code> myself (since I want e.g. just one long column on a phone screen), and it also wouldn't be an AdapterView, which this feels like it ought to be.</p>
  
  <p><strong>Edit:</strong> in fact, clone and own is not practical here. GridView depends on inaccessible parts of its parent and sibling classes, and would result in importing at least 6000 lines of code (AbsListView, AdapterView, etc.)</p>