SwipeRefreshLayout does not work (animation not shown, onRefresh not called) when the first item in the RecyclerView within the SwipeRefreshLayout has a height of zero.
You can check out a test project on Github that shows this.
My question is: can this effect be circumvented?
In my actual project, due to circumstances not in my hand (Ad library)the first item of my list will sometimes have a height of 0, so setting it to View.GONE or height to 1 is not an option.
Found an workaround: Put RecyclerView to into additional view:
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent" />
</FrameLayout>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
it cause additional overdraw, but works
few more suggestions found here: https://github.com/airbnb/epoxy/issues/74
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