I have an activity with coordinator layout.inside activity there is a fragment with Recycler view and float button.how can I show/hide float button when Scroll Recycler view and
Solution in Kotlin
recycler_view = findViewById(R.id.recycler_view)
recycler_view.addOnScrollListener(object : RecyclerView.OnScrollListener(){
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
if(dy > 0){
fab.hide();
} else{
fab.show();
}
super.onScrolled(recyclerView, dx, dy)
}
})