2

I am trying to implement a listView inside another listView as shown in android: listview in listview

The problem is that only the first item of the child list is visible while remaining remain hidden.

Community
  • 1
  • 1
user2041902
  • 593
  • 1
  • 6
  • 21
  • 1
    FYI, this setup will not work well. – S.D. Feb 15 '13 at 10:08
  • list view inside list view is not better idea but you can use alternate ideas if its not affect your layouts. check this : http://dj-android.blogspot.in/2013/01/android-better-alternative-of.html – Dhaval Parmar Feb 15 '13 at 10:36

4 Answers4

0

What is the usage for you to give Listview inside Listview..Better you can use expandable ListView

Murugan
  • 31
  • 2
0

First, why do you want to put a ListView in a ListView ? Maybe your problem can be solved by using an ExpandableListView.

A ListView is a scrollable component and it's not a good idea to nest scrollable components.

If you still want to use nested ListView, you have to know that the calculated height of a ListView is the height of his first element.

So if you want to use a ListView in a ListView, you will have to code a CustomListView and Override some methods as :

  • onLayout
  • onMeasure
  • onDraw / dispatchDraw

To know more about Custom components, here is a nice explanation given by Chiuki Chan : Follow the link

Lionel Père
  • 526
  • 2
  • 5
  • 17
0

I just thought you may had something wrong in item XML file.Check whether you used "match_parent" or "fill_parent".

Tommy
  • 301
  • 2
  • 16
0

We can use ExpandableHeightGridView and set expanded true.