I use android.support.v4.widget.SwipeRefreshLayout
in my Android app. It wraps a ListView
. The content of the list view is downloaded from a server.
A progress view is shown when user swipes down in order to reload data from server. The progress view looks like a piece of circle that grows and shrinks during the animation. It seems that the style of this progress view cannot be customized much. However, I am fine with its built-in style.
I also show the same progress animation during initial data loading. This can be achieved by calling mySwipeRefreshLayout.setRefreshing(true)
. That's perfectly OK too.
However, I would like to show the same progress indication through the whole app. Consider e.g. another activity that looks like a form with submit button. There is neither a ListView
nor a SwipeRefreshLayout
in this form activity. Some progress indication should be displayed while the submitted data are transferred to the server. I want to show a progress bar with the same animation like in SwipeRefreshLayout.
Is there a simple and clean way to have the same progress indicator for both a SwipeRefreshLayout
and a form activity that does not contain any list view and refresh layout and does not support any swipe gesture?
Thanks.
yes you can use
SwipeRefreshLayout
to show likeProgressDialog
when button click. check below.i have added
SwipeRefreshLayout
inside my layout file still there is notListView
orScrollView
. just like belownow in my activity i used
AsyncTask
to showSwipeRefreshLayout
. also usemSwipeRefreshLayout.setOnRefreshListener(null)
to stop swipe gesture.EDITED:
you can use SwipeRefreshLayoutBottom library from Github. its same as
swiperefreshlayout
. check belowdidn't work for me, so I made this method to enable and disable refreshing.