Tablelayout - 在列头点击排序行 [英] Tablelayout - sort rows on column header click
问题描述
我创建了一个表格布局和动态添加行了。我要作为排序依据列标题点击表的内容。正如在HTML中,我们可以很容易地使用数据的DataTable进行排序。使用一些jar文件或现有的Android功能我可以实现在Android中tablelayout相同的功能?
I have created a table layout 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 same functionality in android tablelayout using some jar file or existing android functions?
在此先感谢...
推荐答案
你看,你可以使用的 Collection.sort()
吧。
See, you can use Collection.sort()
for it.
有上这么多的教程。看<一个href=\"http://examples.java$c$cgeeks.com/core-java/util/arraylist/sort-arraylist-example-using-collections-sort/\"相对=nofollow> ArrayList的,例如,使用的集合排序。这是用于排序的逻辑。
你可以让你可以在你的表头点击执行的方法。
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.
这篇关于Tablelayout - 在列头点击排序行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!