Search code examples
androidmaterial-designmaterial-componentsmaterial-components-android

Material component Bottom App Bar change back icon color and slide up programatically


I am implementing the Bottom App Bar (https://material.io/develop/android/components/bottom-app-bar/) and I am facing two challenges.

  1. When using the Navigation component and navigate to a new fragment, the drawer icon turns int <- back button but it is black. Any way to change its color?

  2. If I set the behavior to myAppBar.hideOnScroll = true then when I am in a Recyclerview and I scroll up, the bar gets hidden which is really nice. However, if I navigate to a new fragment, the bar remains hidden. How can I programatically show the bar again?

LE: 1. was fixed by using android:theme ThemeOverlay.MaterialComponents.Dark.ActionBar


Solution

  • Edit: The BottomAppBar can now be scrolled on or off the screen programatically. See https://issuetracker.google.com/issues/111925683

    For now you could just set or animate the translationY property of the BottomAppBar to be 0. And perform the animations run by the BottomAppBar.Behavior on the fab: https://github.com/material-components/material-components-android/blob/841ba156fc33e721b991684c8a4bb4afdc56d90c/lib/java/com/google/android/material/bottomappbar/BottomAppBar.java#L754-L782