如何在android中向上更新列表项?
我有一个列表视图,当用户单击由自动完成文本视图提供的单词建议时,它将不断添加其项目...
正如我们所知,列表视图的列表项目将添加到另一个项目的底部,这将使最后一项成为最底部的一项。
我想要做的是使列表项向上添加,以便最后添加的项目将成为我的活动布局上所有项目的第一个或最顶部,第一个添加的项目成为所有项目的最底部。 ..
我希望它不会那么难弄清楚...
谢谢!
i have a list view that will keep adding its items when the user clicks the word suggestion, provided by an autocompletetextview....
as we know, the list items of a listview will be added at the bottom of the other item, this will make the last item become the most bottom of all.
what i want to do is to make the list items added upward, so that the last added item will be the first or the most top of all items on my activity layout, and the first added item become the most bottom of all items....
I hope it won't be so difficult to figure out...
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
解决方案可能是简单地扩展 ArrayAdapter (假设您还没有这样做)并实现(覆盖) getView()、getCount() 等。您覆盖的 getView() 方法然后可以根据您的数据数组生成单独的视图像平常一样的项目,除了它会以相反的顺序从数组中获取项目。
A solution could be to simply extend ArrayAdapter (assuming you're not doing so already) and implement (override) getView(), getCount(), etc. Your overridden getView() method could then generate the individual views based upon your data array of items as usual, except that it would take items from the array in reverse order.