Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SwipeRefreshLayout behind ActionBar

When using a SwipeRefreshLayout in combination with a overlay mode ActionBar, the loading animation will be displayed behind the actionbar, making it almost invisible.

Is there anything I can do to show it on top of the actionbar?

like image 238
Frank Avatar asked Jun 25 '14 16:06

Frank


People also ask

What is SwipeRefreshLayout?

The swipe-to-refresh user interface pattern is implemented entirely within the SwipeRefreshLayout widget, which detects the vertical swipe, displays a distinctive progress bar, and triggers callback methods in your app.

How to use SwipeRefreshLayout in android?

Android SwipeRefreshLayout is a ViewGroup that can hold only one scrollable child. It can be either a ScrollView, ListView or RecyclerView. The basic need for a SwipeRefreshLayout is to allow the users to refresh the screen manually. This is pretty common in the Facebook Newsfeed screen.

How to disable pull to refresh in android studio?

To disable the gesture and progress animation, call setEnabled(false) on the view. This layout should be made the parent of the view that will be refreshed as a result of the gesture and can only support one direct child.

How do you refresh on Kotlin?

Activity Code for Pull to Refresh Functionality in KotlininiRefreshListener() method will set a listener to the SwipeRefreshLayout and pull to refresh operation is performed by the user. In the above code, we are calling the function iniRefreshListener() and to load Xml we have to call the setContentView(R. layout.


1 Answers

In the Material Design version of the appcompat-v7 library (v21.0.0), SwipeRefreshLayout gets a method to set the Progress View offset.

https://developer.android.com/reference/android/support/v4/widget/SwipeRefreshLayout.html#setProgressViewOffset(boolean,%20int,%20int)

public void setProgressViewOffset (boolean scale, int start, int end)

The refresh indicator starting and resting position is always positioned near the top of the refreshing content. This position is a consistent location, but can be adjusted in either direction based on whether or not there is a toolbar or actionbar present.

Parameters

scale Set to true if there is no view at a higher z-order than where the progress spinner is set to appear.

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.

like image 76
TalkLittle Avatar answered Sep 22 '22 03:09

TalkLittle