问题
I've created a TableLayout
and added rows to it dynamically. I want to sort table content on column header click. Just as in HTML, we can easily sort data using datatables. Can I implement the same functionality in Android TableLayout
using some jar files or existing Android functions?
Thanks in advance.
回答1:
See, you can use Collection.sort() for it.
There are so many tutorials on it. see arraylist-example-using-collections-sort. this is logic for sorting. you can make a method that you can execute on your table header click.
来源:https://stackoverflow.com/questions/20063667/tablelayout-sort-rows-on-column-header-click