<分区>
我有一个用于获取 RSS 提要的应用程序,我正在尝试实现下拉刷新。我引用了 https://github.com/johannilsson/android-pulltorefresh . 任何人都可以帮助将其包含在 Eclipse 中吗?我们有这个的 jar 吗?
<分区>
我有一个用于获取 RSS 提要的应用程序,我正在尝试实现下拉刷新。我引用了 https://github.com/johannilsson/android-pulltorefresh . 任何人都可以帮助将其包含在 Eclipse 中吗?我们有这个的 jar 吗?
最佳答案
可以引用this视频和this页面(带有代码)来实现它,因为在 android 中还没有直接控件
一些 fragment : 在 XML 中:
<!--
The PullToRefresh-ListView replaces a standard ListView widget,
and has all the features android.widget.ListView has.
-->
<eu.erikw.PullToRefreshListView
android:id="@+id/pull_to_refresh_listview"
android:layout_height="fill_parent"
android:layout_width="fill_parent" />
关于 Activity :
// Set a listener to be invoked when the list should be refreshed.
PullToRefreshListView pullToRefreshView = (PullToRefreshListView) findViewById(R.id.pull_to_refresh_listview);
pullToRefreshView.setOnRefreshListener(new OnRefreshListener<ListView>() {
@Override
public void onRefresh(PullToRefreshBase<ListView> refreshView) {
// Do work to refresh the list here.
new GetDataTask().execute();
}
});
private class GetDataTask extends AsyncTask<Void, Void, String[]> {
...
@Override
protected void onPostExecute(String[] result) {
// Call onRefreshComplete when the list has been refreshed.
pullToRefreshView.onRefreshComplete();
super.onPostExecute(result);
}
}
关于android - 如何在Android应用程序中实现下拉刷新,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14332605/