我正在努力使用Google支持库的SwipeRefreshLayout中的文档.
当我使用setOnRefreshListener设置的回调接收刷新调用时,我做了我的操作,之后,我发现我需要再次将刷新状态设置为false – 如果我不这样做,我再也不能通过刷卡触发它!
mSwipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipe_refresh_layout);
if (mSwipeRefreshLayout != null) {
mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
Toast.makeText(getApplication(),"Refreshing!",Toast.LENGTH_SHORT).show();
//requestDataRefresh();
mSwipeRefreshLayout.setRefreshing(false);
}
});
}
到现在为止还挺好.但是看看setRefreshing的文档:
/**
* Notify the widget that refresh state has changed. Do not call this when
* refresh is triggered by a swipe gesture.
*
* @param refreshing Whether or not the view should show refresh progress.
*/
public void setRefreshing(boolean refreshing) {...
但是再次将刷新状态设置为false正是刷新后我必须要做的!
文档是错误的还是我看错了?
该文件不应该说:“当刷卡手势触发刷新时,不要将刷新状态调用为真”
你怎么看?
最佳答案