HeaderListView icon indicating copy to clipboard operation
HeaderListView copied to clipboard

Switching Header Label values

Open gasparuff opened this issue 11 years ago • 2 comments

I'm showing a ListView with 3 sort buttons above it (Name, Country, Age). When sorting changes, I'm updating the HeaderListview like this: ((PeopleSectionedAdapter) listView.getAdapter()).setLinkedPeopleMap(indicesBR.get("name")); ((PeopleSectionedAdapter) listView.getAdapter()).notifyDataSetChanged(); or ((PeopleSectionedAdapter) listView.getAdapter()).setLinkedPeopleMap(indicesBR.get("country")); ((PeopleSectionedAdapter) listView.getAdapter()).notifyDataSetChanged(); or ((PeopleSectionedAdapter) listView.getAdapter()).setLinkedPeopleMap(indicesBR.get("age")); ((PeopleSectionedAdapter) listView.getAdapter()).notifyDataSetChanged();

Actually it works, but when I havent scrolled below the 2nd Header, the currently active header doesn't get changed at all. E.g. I have selected "Name" and I scrolled down just a very small amount - then the currently active header still says "A", while the next visible header displays the correct title. I'd have to scroll down until the next header gets active and then scroll back to update the previously active one. This problem doesn't occur if I don't do any scrolling at all. How can I fix this?

gasparuff avatar Sep 08 '14 14:09 gasparuff

Any update on this? I need to change header values too!

Wirwing avatar Jan 03 '15 05:01 Wirwing

It's working for me. Simply remove the all view of header when set adapter to list view. Change the setAdapter() of HeaderListView to

public void setAdapter(SectionAdapter adapter) { mAdapter = adapter; if(mHeader != null) mHeader.removeAllViews(); mListView.setAdapter(adapter); }

JaydipMeghapara avatar Jun 07 '16 05:06 JaydipMeghapara