The SwipeRefreshLayout was added to the Android Support Library in v19.1.0: https://developer.android.com/reference/android/support/v4/widget/SwipeRefreshLayout.html
I have now added it to my application and it works as advertised. However, if I swipe slowly, I notice the overscroll is very jerky. See this video to see what I mean: https://www.youtube.com/watch?v=HAuadMZYRf0
I see the issue using multiple layouts of varying levels of complexity. The layout shown in the video linked above is:
<android.support.v4.widget.SwipeRefreshLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/swipe_refresh_widget"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ListView
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</android.support.v4.widget.SwipeRefreshLayout>
And the relevant Java code:
@Override
public View onCreateView(final LayoutInflater inflater, final ViewGroup container,
final Bundle savedInstanceState) {
final View v = inflater.inflate(R.layout.list, container, false);
mSwipeRefreshWidget = (SwipeRefreshLayout) v.findViewById(R.id.swipe_refresh_widget);
mSwipeRefreshWidget.setOnRefreshListener(this);
mSwipeRefreshWidget.setColorScheme(R.color.refresh1, R.color.refresh2, R.color.refresh3,
R.color.refresh4);
// snip
}
Full source on Github: https://github.com/meisteg/PickTheWinner/blob/d764c69af0c72a2d1173c6fb4328bd85088d8b59/app/src/com/meiste/greg/ptw/tab/Schedule.java
Anyone have suggestions how to fix the jerkiness? The overscroll should be smooth, no matter how long I take to overscroll the required distance. Thanks!
This is fixed in the 20.0 version of the support-library v4. If you are using gradle :
compile 'com.android.support:support-v4:20.0'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With