2

I am currently using the combination of BottomAppBar And FloatingActionButton in my Layout (obviously inside CoordinatorLayout): see layout:

  <com.google.android.material.bottomappbar.BottomAppBar
        android:id="@+id/bar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        app:backgroundTint="@color/primarycolor"
        app:theme="@style/ThemeOverlay.MaterialComponents.Dark"
        app:fabAlignmentMode="center"
        app:layout_scrollFlags="scroll|enterAlways"
        app:navigationIcon="@drawable/ic_menu_time" />

    <com.google.android.material.floatingactionbutton.FloatingActionButton
        android:id="@+id/fab"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:layout_scrollFlags="scroll|enterAlways"
        app:backgroundTint="#FFFF0000"
        app:layout_anchor="@id/bar"
        app:rippleColor="#FFFF8888"
        app:srcCompat="@drawable/ic_fab_search" />

The behavior of the list scroll is working like a charm for BottomAppBar , but I have big issues with the FloatingActionButton.

As you can see on below screenshot, the BottomAppBar disappear completely, and that's awesome, but I cannot get the same for the FAB. It just moves a little bit at the bottom.

Any idea where I could start looking to fix this? The correct behaviour would be the FAB to follow the Bar and simply disappear

enter image description here

And after the scroll:

enter image description here

Waza_Be
  • 39,545
  • 47
  • 176
  • 256

1 Answers1

0

You should hide the FAB yourself. Just call fab.hide() and fab.show() to manage its visibility.

ʍѳђઽ૯ท
  • 15,369
  • 7
  • 47
  • 103
  • Use formatting tools to make your post more readable. Use `code blocking` for code and log and error texts and **bold** and *italics* to highlight things – Morse Jul 27 '18 at 14:07