TAGS :Viewed: 15 - Published at: a few seconds ago

[ Get default value for start and end in SwipeRefreshLayout ]

SwipeRefreshLayout has a method called setProgressViewOffset where you can set start and end parameter:

start: The offset in pixels from the top of this view at which the progress spinner should appear.

end: The offset in pixels from the top of this view at which the progress spinner should come to rest after a successful swipe gesture.

It is useful when we have a floating actionBar/Toolbar, and have added a header to our ListView and want to start the SwipeRefresh from bottom of header View.

I wonder how can I get the default start and end value?

Then for instance for end parameter, I can pass default end + actionBarSize to the setProgressViewOffset.

Answer 1


try this values .. extracted from the SwipeRefreshLayout class

int DEFAULT_CIRCLE_TARGET = 64;
final DisplayMetrics metrics = getResources().getDisplayMetrics();
swipeLayout.setProgressViewOffset(true,swipeContainer.getProgressCircleDiameter(),(int)(DEFAULT_CIRCLE_TARGET *metrics.density));