Remove loading spinner in SwipeRefreshLayout

走远了吗. 提交于 2019-12-05 11:52:48

问题


I use a SwipeRefreshLayout to reload the content of a listview. It works and the onRefreshListener is triggered but the small loading spinner that appears onswipe doesn't want to dismiss after the loading is complete. Is there a way to make it go ?

Edit : fixed SwipeView means SwipeRefreshLayout


回答1:


Do you mean SwipeRefreshLayout? if so use SwipeRefreshLayout.setRefreshing(false)




回答2:


The correct way of using it is like this:

if (swipeLayout.isRefreshing()) {
   swipeLayout.setRefreshing(false);
}



回答3:


If you are using SwipeRefreshLayout then use swipeLayout_object.setRefreshing(false); for dismiss that loading icon. i.e.

private SwipeRefreshLayout swipeLayout;

protected void onCreate(Bundle savedInstanceState) {
....


 swipeLayout = (SwipeRefreshLayout) findViewById(R.id.swipe_container);

 swipeLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {

                @Override
                public void onRefresh() {
                    //Do your task
                    swipeLayout.setRefreshing(false);

                }
            });
}

Details available here. https://developer.android.com/reference/android/support/v4/widget/SwipeRefreshLayout.html




回答4:


here is complete solution for loading a page and remove loading animation after page is fully loaded.

 private class CustomWebViewClient extends WebViewClient {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
    view.loadUrl(url);
    return true;
}

@Override
public void onPageFinished(WebView view, String url) {
    swipeRefreshLayout.setRefreshing(false);
}


来源:https://stackoverflow.com/questions/28582544/remove-loading-spinner-in-swiperefreshlayout

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!