@Override
    public void onScroll(AbsListView absListView, int firstVisibleItem, int visibleItemCount, int totalItemCount) {

        if (mLastFirstVisibleItem < firstVisibleItem) {
            if (floatShowing) floatShowing = false;
            if (!floatHiding) {
                ViewPropertyAnimator.animate(view).translationY(500).setDuration(300);
                floatHiding = true;
            }
        }
        if (mLastFirstVisibleItem > firstVisibleItem) {
            if (floatHiding) {
                floatHiding = false;
            }
            if (!floatShowing) {
                ViewPropertyAnimator.animate(view).translationY(0).setDuration(300);
                floatShowing = true;
            }
        }
        mLastFirstVisibleItem = firstVisibleItem;
        if (onScrollListener != null)
            onScrollListener.onScroll(absListView, firstVisibleItem, visibleItemCount, totalItemCount);
    }
Created by hamedpc on 4/25/2015.
This widget uses NineOldAndroid to animate the view so you're gonna need to include it in your project
MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/AutoHideButtonFloat.java