سؤال

What I want to make with Android layout looks like this :

example image

I thought out several options. (Total lenth of list is about 80 rows.)

  1. ListView which has TextView and GridView (I tried, but GridView didn't stretched to right size.)
  2. ExpandableList/GridView from https://stackoverflow.com/a/4536955/358813
  3. ScrollView which has a LinearLayout which has TextView and GridView.
  4. Calculate GridView height using its array source and set LayoutParams.

ExpandableGridView looks good, but there is a comment under a similar question. My app uses pretty much bitmaps, so I'm worried about the comment :

this solution is not memory efficient and the app will crash if the cells are images.

And ExpandableListView is using hack. It's not a big problem, but it makes me not comfortable.

Calculating height seems to work, but I didn't try. I should solve this problem by this way?

Is there any solution not using hack(or being able to recyle view)? I'm familiar with HTML&CSS, so I can't understand why this stuff is not easy.. At first I thought that this is not so difficult because it looks similiar with ExpandableListView.

هل كانت مفيدة؟

المحلول

You can put a horizontal ListView inside a vertical ListView. Think about the way Facebook shows photos in it's mobile apps. By this way you won't be breaking standard behavior of a ListView and you won't need hacking.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top