3

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

1
  • Add your XML Code Commented Nov 5, 2019 at 12:10

1 Answer 1

1
+50

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

Sign up to request clarification or add additional context in comments.

1 Comment

Yes, it definitely solves my problem, although it looks like a hack. I also use not android.support.v7.appcompat.R.attr.actionBarSize but androidx.appcompat.R.attr.actionBarSize. It seems like my problem goes away when I also change the second parameter of this method. That is, not 0, but for example, -pixel-size-of-actionbar. But this changes sensitivity of swipe. So far, I'm still trying to find more accurate values for my situation. Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.