gduh
gduh

Reputation: 1172

How can I expand one item inside a list view but not all of them (Not using ExpandListView)?

I have a simple listview, each item can be selected by a simple touch. All is very simple until now. But one of these items, somewhere in the list, on a touch, must show news items as a sublist and then a second touch on the same item must hide/collapse the sublist.

Like this :

After a touch on item3 :

It exists ExpandListView but I don't think that it could be ok here. Another way could be add/remove items from the ArrayList object and then call NotifyDataSetChanged, but it's not very fun. So, what is the best way to do that ?

Upvotes: 1

Views: 216

Answers (3)

Anil KARA
Anil KARA

Reputation: 21

You should look Advanced RecyclerView library. You can find all combination of list view.

Upvotes: 0

user5742865
user5742865

Reputation:

use expendable list view in that case.

Upvotes: 2

aelimill
aelimill

Reputation: 1015

At least two ways

1) Add them to the touched view hierarchy on clicked and remove after second click
2) Add views to the xml, make VISIBILITY.GONE and change visibility on click events

Upvotes: 1

Related Questions