Thursday, 2 July 2015

Android how to manually trigger swipeRefreshLayout


It is a bug that calling "swipeRefreshLayout.setRefreshing(true);" doesn't trigger the refresh widget showing.


Here is the solution:


private void startShowingLoadingProgress() {
    swipeRefreshLayout.setProgressViewOffset(false, 0,
            (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 24, getResources().getDisplayMetrics()));
    swipeRefreshLayout.setRefreshing(true);
}




http://stackoverflow.com/questions/26858692/swiperefreshlayout-setrefreshing-not-showing-indicator-initially


No comments:

Post a comment