gpt4 book ai didi

android - 在 android 中拉取 ListView 时刷新适配器

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:12:39 24 4
gpt4 key购买 nike

如何应用下拉ListView的效果,释放时会刷新。和Facebook一样,下拉时会刷新NewsFeeds。

最佳答案

您可以使用 this用于在 android 中创建此类列表。

您必须在代码中使用刷新监听器:

   PullToRefreshListView listView = (PullToRefreshListView) findViewById(R.id.pull_to_refresh_listview);
listView.setOnRefreshListener(new OnRefreshListener() {


public void onRefresh() {
// Your code to refresh the list contents

// ...

// Make sure you call listView.onRefreshComplete()
// when the loading is done. This can be done from here or any
// other place, like on a broadcast receive from your loading
// service or the onPostExecute of your AsyncTask.

listView.onRefreshComplete();
}
});

关于android - 在 android 中拉取 ListView 时刷新适配器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12974112/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com