Muhammad Arsal Muhammad Arsal - 4 months ago 54
Android Question

Hide and re-appear floating action button, android

I'm using floating action button in my android application. I've implemented a feature when a user scrolls down the list, FAB disappears. It appears back when a user scrolls up.

myRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);

if (dy >0) {
// Scroll Down
if (floatingActionButton.isShown()) {
else if (dy <0) {
// Scroll Up
if (!floatingActionButton.isShown()) {;

How to make FAB re-appear after 5 seconds even if the user doesn't scroll up?
If you're still not clear with my question, you can check this feature out in LinkedIn android application.


Use View.postDelayed() thread. For ex:

floatingActionButton.postDelayed(new Runnable() {
   public void run() {;