Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SwipeRefreshLayout progress drawable doesn't hide completely on KitKat

I have something like this:

<ConstraintLayout>
    <SwipeRefreshLayout>
        <RecyclerView>

Constraint also has a animateLayoutChanges = "true" But I'm sure it's not a cause.

When I do swipe-to-refresh gesture - it's okay, everything works fine, progress hides as it should. But if I swipe down, then, without releasing my finger, I swipe up to hide the progress drawable, part of it remains visible.

Appears only on 4.4 and below.

enter image description here

like image 220
Victor Cold Avatar asked Apr 26 '26 02:04

Victor Cold


1 Answers

Actionbar could got thinner when orientation changes or you have set actionbar size manually. Set the offset in pixels from the top of the view at which the progress spinner should come to reset after a successful swipe gesture to the current actionbar size.

TypedValue typedValue = new TypedValue();
getActivity().getTheme().resolveAttribute(android.support.v7.appcompat.R.attr.actionBarSize, typedValue, true);
mSwipeRefreshLayout.setProgressViewOffset(false, 0, getResources().getDimensionPixelSize(typedValue.resourceId));

Solution is taken from an answer to a different question about: swipeRefreshLayout

Test if this helps you first: mSwipeRefreshLayout.setProgressViewOffset(false, 0, 64) or maybe a little bigger than 64

like image 111
Sina Avatar answered Apr 27 '26 16:04

Sina



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!