问题
I've a list view in that it contain a header (like addHeaderView(layout) and Header having three columns) and when i click on first column of header then the list is to be sorted according to the values lied into the first column, then if i click second column of header then list is being sorted according to second column and so on. But now its working like whenever i click any column the list is being sorted based on first column so how can i achieve my problem?
Thanks, @nag.
回答1:
- Put header for column title in listview.
- for multi column in listview try this.
- to sorting listview column, sort the list (String array[]) you providing in listview.
回答2:
Well in case like this in the listener you sort you adapter differently , that's it in case the A button i pressed than you sort the adapter according some criteria A, if the B button i pressed than than you sort the adapter according some criteria B. after every change you call notifyDataSetChanged();
来源:https://stackoverflow.com/questions/7441189/how-to-sort-android-listview-by-column-wise