Slide 71
Slide 71 text
Fab animation
71
class RecyclerViewWithFloatingActionButton : RecyclerView {
var mFloatingActionButton: FloatingActionButton? = null
constructor(context: Context) : super(context) {}
constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) {}
constructor(context: Context, attrs: AttributeSet?, defStyle: Int) : super(context, attrs, defStyle) {}
override fun onScrolled(dx: Int, dy: Int) {
super.onScrolled(dx, dy)
if (dy > 0) {
// Scrolling up
mFloatingActionButton?.hide()
} else {
// Scrolling down
mFloatingActionButton?.show()
}
}
}