android - Using Google Design Library how to hide FAB button on Scroll down? -
google have released design library, using
compile 'com.android.support:design:22.2.1'
however cant see code examples of how use library , how animate fab bar on scroll. guess can listen scroll events on listview , animate button myself, not baked api (is not point of support library).
is there examples ?
thanks
if you're using recyclerview
, you're looking simple, can try this:
recyclerview.addonscrolllistener(new recyclerview.onscrolllistener(){ @override public void onscrolled(recyclerview recyclerview, int dx, int dy){ if (dy > 0) fabaddnew.hide(); else if (dy < 0) fabaddnew.show(); } });
by replacing 0
constant, can adjust sensitivity of triggering, providing smoother experience
Comments
Post a Comment