如何更改Pull to refresh库中的(Release to Refresh)我正在使用以下库chrisbanes / Android-PullToRefresh,这是我工作的结果My App
这是我的xml文件:
<com.handmark.pulltorefresh.library.PullToRefreshListView
android:id="@+id/pull_to_refresh_listview"
android:layout_height="fill_parent"
android:layout_width="fill_parent" />
这是我的逻辑:
PullToRefreshListView pullToRefreshView = (PullToRefreshListView)findViewById(R.id.pull_to_refresh_listview);
pullToRefreshView.setOnRefreshListener(new OnRefreshListener<ListView>() {
@Override
public void onRefresh(PullToRefreshBase<ListView> refreshView) {
new LoadNews().execute();
}
});
private class LoadNews extends AsyncTask<Void, Void, Void> {
@Override
protected void onPreExecute() {
super.onPreExecute();
}
@Override
protected Void doInBackground(Void... arg0) {
if(database.countRows() > 0)
dataList = database.retrieveAll();
return null;
}
@Override
protected void onPostExecute(Void result) {
lv.onRefreshComplete();
super.onPostExecute(result);
if(dataList != null)
UpdateList();
}
}
如何更改文字文字和文字颜色?
答案 0 :(得分:0)
我刚刚遇到这个没有回答。所以现在发布它。
这里,传递的字符串来自strings.xml,方法非常明显。为Chris Banes干杯:)
pullToRefreshView.getLoadingLayoutProxy().setPullLabel(
getString(R.string.product_pull_label));
pullToRefreshView.getLoadingLayoutProxy().setRefreshingLabel(
getString(R.string.product_refresh_label));
pullToRefreshView.getLoadingLayoutProxy().setReleaseLabel(
getString(R.string.product_release_label));
快乐编码:)
答案 1 :(得分:0)
<com.handmark.pulltorefresh.library.PullToRefreshListView
xmlns:ptr="http://schemas.android.com/apk/res-auto"
android:id="@+id/pull_to_refresh_listview"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
ptr:ptrHeaderTextColor="@color/text_corner"
/>