[英]How to create a Listview which refreshes along with scrolling in android?
I want to create a ListView which gets information from a database using VOLLEY. 我想创建一个使用VOLLEY从数据库获取信息的ListView。 I want to call the Volley in a loop which will allow the data to come one by one.
我想循环调用Volley,这将允许数据一个接一个地传送。 Is there any way to make a ListView which adds items whenever volley gets a item returned from the database?
有什么方法可以使ListView在凌空获取从数据库返回的项目时添加项目?
You can use some libraries way cooler to top your ListView from android-arsenal.com . 您可以使用一些更酷的库来从android-arsenal.com的ListView顶部。 here is a list of libraries that are even new https://android-arsenal.com/tag/78?sort=created
这是什至是新的库列表https://android-arsenal.com/tag/78?sort=created
You can see a detailed video by Vivz from Slidenerd Pull to refresh tutorial 您可以从Slidenerd Pull观看Vivz的详细视频, 以刷新教程
Add items to your item set, and simply notify the adapter ( adapter.notifyDataSetChanged();
) that items been changed. 将项目添加到项目集中,然后简单地通知适配器(
adapter.notifyDataSetChanged();
)项目已更改。
If you going to insert them one by one you might want to look into RecyclerView and use its notify methods like notifyItemInserted
. 如果要一一插入它们,则可能需要查看RecyclerView并使用其notify方法(如
notifyItemInserted
。 It is specially designed for that and comes with animations to represents an item being inserted/updated/moved/deleted. 它是专门为此设计的,并带有动画来表示要插入/更新/移动/删除的项目。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.