2

How can i force to show the BottomAppBar? I am using a viewpager and my BottomAppBar has hideOnScroll attribute. My first tab in viewpager is scrollable. Once I scroll down on my first fragment the bottom appbar dissapears, then when I go to the 2nd tab of my view pager(which is not scrollable) the bottom appbar does not re appear.

<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/rootLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">


<LinearLayout
    app:layout_dodgeInsetEdges="bottom"
    android:id="@+id/viewpagerRl"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <androidx.viewpager.widget.ViewPager
        android:id="@+id/flContent"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

</LinearLayout>

<com.google.android.material.bottomappbar.BottomAppBar
    android:id="@+id/bottomAppbar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="bottom"
    app:backgroundTint="@color/colorPrimary"
    app:fabAlignmentMode="end"
    app:fabCradleRoundedCornerRadius="20dp"
    app:hideOnScroll="true"
    app:layout_scrollFlags="scroll|enterAlways"
    app:navigationIcon="@drawable/ic_hamburger"
    app:theme="@style/MerchantBottomAppBar" />

<com.google.android.material.floatingactionbutton.FloatingActionButton
    android:id="@+id/fab"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:src="@drawable/ic_add_white"
    app:fab_size="normal"
    app:layout_anchor="@id/bottomAppbar"
    app:layout_anchorGravity="center" />

</androidx.coordinatorlayout.widget.CoordinatorLayout>

1 Answers1

0

Programmatically, you can invoke 'performShow'.

See documentation at https://developer.android.com/reference/com/google/android/material/bottomappbar/BottomAppBar#performshow

El Stepherino
  • 600
  • 6
  • 18