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

Victor Cold
  • 603
  • 5
  • 15

1 Answers1

1

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

Sina
  • 2,683
  • 1
  • 13
  • 25
  • 1
    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! – Victor Cold Nov 06 '19 at 11:21