Skip to content

Instantly share code, notes, and snippets.

@EfeBudak
Created June 29, 2018 08:11
Show Gist options
  • Save EfeBudak/bdfb8edc2a0e2724b928a1373193fdd4 to your computer and use it in GitHub Desktop.
Save EfeBudak/bdfb8edc2a0e2724b928a1373193fdd4 to your computer and use it in GitHub Desktop.
recyclerView.addOnScrollListener(object : RecyclerView.OnScrollListener() {
override fun onScrolled(recyclerView: RecyclerView?, dx: Int, dy: Int) {
super.onScrolled(recyclerView, dx, dy)
if ((recyclerView?.layoutManager as LinearLayoutManager)
.findFirstCompletelyVisibleItemPosition() == 0) {
buttonReturnToTop.visibility = View.GONE
}
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment