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

标签 android android-layout listview pull-to-refresh

如何应用下拉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/

相关文章:

android - 我们应该在 Kotlin 中绑定(bind) android View 吗?

android - 如何使用 Picasso 加载布局背景

wpf - 如何同步ListCollectionView.CurrentItem和ListView.SelectedItem?

java - Android View 不能被其他线程触及?

java - 尝试运行 Android SDK 时出现 Mac Java 路径问题

android - findViewById() 对于对话框中的 View 返回 null

android - ListView 中的多选

java - ArrayList removeAll() 不删除对象

android - 如何实现这种布局

python - Kivy 从代码中选择 ListView 中的一个项目