当滑动到布局刷新片段中的布局时如何禁用后按
How to disable back press when Swipe to layout is Refreshing layout in Fragment
我在滑动刷新布局时遇到问题,如果当时滑动刷新我的布局,如果我按下后退按钮,它会关闭所有 activity 和片段..
我检查了日志,但没有应用程序终止错误...
您可以使用isRefreshing()
Whether the SwipeRefreshWidget
is actively showing refresh progress.
示例代码
@Override
public void onBackPressed() {
if (swipeRefreshLayout.isRefreshing()){
// swipeRefreshLayout is Refreshing
}else {
// swipeRefreshLayout is not Refreshing call super.onBackPressed();
super.onBackPressed();
}
}
我在滑动刷新布局时遇到问题,如果当时滑动刷新我的布局,如果我按下后退按钮,它会关闭所有 activity 和片段.. 我检查了日志,但没有应用程序终止错误...
您可以使用isRefreshing()
Whether the
SwipeRefreshWidget
is actively showing refresh progress.
示例代码
@Override
public void onBackPressed() {
if (swipeRefreshLayout.isRefreshing()){
// swipeRefreshLayout is Refreshing
}else {
// swipeRefreshLayout is not Refreshing call super.onBackPressed();
super.onBackPressed();
}
}