Back to project page FloatingActionButton.
The source code is released under:
MIT License
If you think the Android project FloatingActionButton listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.melnykov.fab; //w w w . j a v a 2s . c o m import android.support.v7.widget.RecyclerView; abstract class RecyclerViewScrollDetector extends RecyclerView.OnScrollListener { private int mScrollThreshold; abstract void onScrollUp(); abstract void onScrollDown(); @Override public void onScrolled(RecyclerView recyclerView, int dx, int dy) { boolean isSignificantDelta = Math.abs(dy) > mScrollThreshold; if (isSignificantDelta) { if (dy > 0) { onScrollUp(); } else { onScrollDown(); } } } public void setScrollThreshold(int scrollThreshold) { mScrollThreshold = scrollThreshold; } }