2

I have a CoordinatorLayout which is used to collapse a toolbar. The CoordinatorLayout has a parent of SwipeRefreshLayout

<SwipeRefreshLayout>
    <CoordinatorLayout>
        <AppBarLayout>
            ...
        </AppBarLayout>
        <NestedScrollView>
            ...
        </NestedScrollView>
    </CoordinatorLayout>
</SwipeRefreshLayout>

I followed this answer to get the swiping working with the SwipeRefreshLayout https://stackoverflow.com/a/30785823

Yes I have seen people say put the refresh layout above the nested scroll, however for this use case I am looking to refresh both the nested layouts contents aswell as the appbar contents

However I have encountered a problem When you go to swipe a refresh and are mid way through it so the refresh spinner is showing but the refresh has not been triggered, when you go to scroll back down, the screen will not scroll, instead the refresh spinner will be stuck there until you take your finger off the screen.

Here are the steps I took to produce this error:

  1. Swipe down so the refresh spinner comes up but do not let go
  2. Swipe back up as if you were going to scroll down the screen

Edit: I have seen this used before on the TradeMe app when you view an item however I cannot figure out how they have gone about it https://play.google.com/store/apps/details?id=nz.co.trademe.trademe&hl=en

OneTrue
  • 31
  • 2

1 Answers1

0

Instead of CoordinatorLayout, try to capsulate only the NestedScrollView within SwipeRefreshLayout.

<CoordinatorLayout>
<AppBarLayout>
        ...
</AppBarLayout>
<SwipeRefreshLayout>
    <NestedScrollView>
        ...
    </NestedScrollView>
</<SwipeRefreshLayout>>
</CoordinatorLayout>
caner
  • 68
  • 6
  • 2
    Sorry, as I said here "Yes I have seen people say put the refresh layout above the nested scroll, however for this use case I am looking to refresh both the nested layouts contents aswell as the appbar contents" Doing it that way would make the refresh spinner come from below the appbar, whereas I want it coming from the top of the screen – OneTrue Nov 07 '18 at 07:00