3

I have a SwipeRefreshLayout which has a ListView inside. I have also ActionBar overlay set and basically the top of the ListView is behind the action bar along with the SwipeRefreshLayout and when i trigger the refresh the animation is behind the ActionBar ergo not visible. Any Ideas?

Bri6ko
  • 1,858
  • 1
  • 18
  • 29
  • 1
    Take a look at this: http://stackoverflow.com/questions/24413680/swiperefreshlayout-behind-actionbar – Naroh Jul 05 '14 at 18:40

3 Answers3

1

Instead of setting paddingTop on the SwipeRefreshLayout, setting the layout_marginTop will make the progress bar visible:

<android.support.v4.widget.SwipeRefreshLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_marginTop="?android:attr/actionBarSize">
kasgoku
  • 5,057
  • 5
  • 20
  • 20
1

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.

Community
  • 1
  • 1
TalkLittle
  • 8,866
  • 6
  • 54
  • 51
0

I have currently come across this when I upgraded my dependency from appcompat 19.1.0 to 21.0.0 and made no code changes.

This is actually a known issue with SwipeRefreshLayout in appcompat 21.0.0.

Look here for a workaround: https://code.google.com/p/android/issues/detail?id=77712

Damien O'Reilly
  • 952
  • 5
  • 12