如何禁用“拉动刷新"功能?行动和仅使用指标? [英] How to disable "pull to refresh" action and use only indicator?

查看:135
本文介绍了如何禁用“拉动刷新"功能?行动和仅使用指标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用SwipeRefreshLayout启用了拉动刷新"到我的项目.

I enabled "pull to refresh" to my project using the SwipeRefreshLayout.

当我向下移动时,出现加载指示器(材料设计样式).我知道,它必须如此工作,但是我想禁用此功能,然后单击某些按钮并使用SwipeRefreshLayout加载指示器开始刷新.

When I move down, appear the loading indicator (material design style). I know, it must so work, but I want to disable this function, and start refreshing by click some button and use SwipeRefreshLayout loading indicator.

我该怎么做?

推荐答案

来自文档:

如果活动仅希望显示进度动画,则应调用setRefreshing(true).要禁用手势和进度动画,请在视图上调用setEnabled(false).

If an activity wishes to show just the progress animation, it should call setRefreshing(true). To disable the gesture and progress animation, call setEnabled(false) on the view.

所以要显示动画:

swiperefreshLayout.setEnabled(true);
swiperefreshLayout.setRefreshing(true);

并隐藏动画:

swiperefreshLayout.setRefreshing(false);
swiperefreshLayout.setEnabled(false);

这篇关于如何禁用“拉动刷新"功能?行动和仅使用指标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆