fix scrollView顶部时下拉刷新

This commit is contained in:
Xwite committed 2023-03-26 13:22:59 +08:00
1 parent e09f0d1c52
commit 402f9e91d4
2 files changed
+4 -5

No files matched your search

@@ -423,15 +423,14 @@ class BookInfoActivity :
} }
} }
} }
scrollView.setOnScrollChangeListener { _, _, scrollY, _, _ ->
refreshLayout?.isEnabled = (scrollY <= 0)
}
refreshLayout?.setOnRefreshListener { refreshLayout?.setOnRefreshListener {
// scrollView 顶部
if (scrollView.scrollY <= 0) {
refreshLayout.isRefreshing = false refreshLayout.isRefreshing = false
refreshBook() refreshBook()
} }
} }
}
private fun setSourceVariable() { private fun setSourceVariable() {
launch { launch {
@@ -399,6 +399,6 @@
</LinearLayout> </LinearLayout>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>