2

I'm a newbie to Android programming and I've been whacking my head over how to do this... I'd like to create an ExpandableListView where the same child item XML (containing add, edit and delete buttons) is populated across all the group items.

Could someone please help me out with this?

Preferably, I'd like to stick with "public class HelloWorld extends Activity" since this is the main activity. But if it "has" to be changed to "extends ...something else", no problem.

Zishan Neno
  • 2,647
  • 7
  • 34
  • 58
  • I've been trying to use a custom adapter that I had been using with a listview. Code taken from the answer on this page: http://stackoverflow.com/questions/4587301/android-adding-subitem-to-a-listview – Zishan Neno Mar 06 '12 at 07:31
  • can you post a drawing of what you're trying to achieve? It's pretty hard to imagine with just your description. – josephus Mar 06 '12 at 07:36
  • Here you go: http://postimage.org/image/nalz1h7ij/ - The same child item should repeat under each expandable list item – Zishan Neno Mar 06 '12 at 08:00
  • so it's just one child item per parent? – josephus Mar 06 '12 at 08:21
  • maybe this link will help you. http://stackoverflow.com/questions/19127071/change-string-array-in-strings-xml-to-arraylist – David Wong Jul 24 '15 at 13:39

1 Answers1

1

Look here for an example of customized expandable ListView. You just need to modify the child elements array to reflect your single-child view. Better yet if you implement it such that you don't need a child element array. Hint: overriding getChildView

josephus
  • 8,284
  • 1
  • 37
  • 57