Friday, September 2, 2011

[android-developers] GridView shows only one row with layout_height=WRAP_CONTENT

I am using a GridView in a LinearLayout. I want the GridView to show
up as tall as needed to show all the rows. However, I am seeing only
one row when set (layout_width=MATCH_PARENT and)
layout_height=WRAP_CONTENT. If I set layout_height to a size that
equals mulitple rows, then I do see those rows.

Looking at onMeasure in http://www.netmite.com/android/mydroid/frameworks/base/core/java/android/widget/GridView.java,
I see that onMeasure does not calculate the number of rows at all, and
so I can understand why only one row shows up. So it seems like an
oversight.

Shouldn't layout_height=WRAP_CONTENT show all rows (if possible)? Is
there any workaround?

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment