如何禁用 "pull to refresh" 操作并仅使用指示器?
How to disable "pull to refresh" action and use only indicator?
我使用 SwipeRefreshLayout
.
为我的项目启用了 "pull to refresh"
当我向下移动时,出现加载指示器(material设计风格)。我知道,它必须如此工作,但我想禁用此功能,并通过单击某个按钮并使用 SwipeRefreshLayout
加载指示器开始刷新。
我该怎么做?
来自文档:
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);
您不必总是启用和禁用。只需在创建视图时禁用一次,然后使用 setRefreshing。
我使用 SwipeRefreshLayout
.
当我向下移动时,出现加载指示器(material设计风格)。我知道,它必须如此工作,但我想禁用此功能,并通过单击某个按钮并使用 SwipeRefreshLayout
加载指示器开始刷新。
我该怎么做?
来自文档:
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);
您不必总是启用和禁用。只需在创建视图时禁用一次,然后使用 setRefreshing。