VincentTheonardo
VincentTheonardo

Reputation: 331

How to display a list of items inside a listview

I am working on a UI which looks like below image Listview with subitem The approach I'm using right now is by creating a Listview that have another listview inside it to display the sub-items. I've read somewhere else that putting a listview inside a listview is a bad practice which could cause a major UI bug. The bug I'm experiencing right now is when the sub List Item is updated, my main outer ListView's height is not updating. For example if I delete one of my sub List item, my outer ListView will show some extra white-space at the end of it. One of the solution that came to me is by using LinearLayout to display the subListItem but then how can I filter those LinearLayout? Any recommendation is appreciated. Thanks!!

Upvotes: 1

Views: 1082

Answers (1)

parambir singh
parambir singh

Reputation: 330

You should use ExpandableListView instead of simple ListViews . Its very easy to use . Please see the a sample code here:

https://www.androidhive.info/2013/07/android-expandable-list-view-tutorial/

Upvotes: 1

Related Questions