fix scrollView顶部时下拉刷新

This commit is contained in:
Xwite
2023-03-26 13:22:59 +08:00
parent b69cfba0d3
commit f24d17653f
2 changed files with 6 additions and 7 deletions

View File

@@ -423,13 +423,12 @@ class BookInfoActivity :
}
}
}
scrollView.setOnScrollChangeListener { _, _, scrollY, _, _ ->
refreshLayout?.isEnabled = (scrollY <= 0)
}
refreshLayout?.setOnRefreshListener {
// scrollView 顶部
if (scrollView.scrollY <= 0) {
refreshLayout.isRefreshing = false
refreshBook()
}
refreshLayout.isRefreshing = false
refreshBook()
}
}

View File

@@ -399,6 +399,6 @@
</LinearLayout>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</androidx.constraintlayout.widget.ConstraintLayout>