Skip to content

[BottomAppBar] app:hideOnScroll="true", BottomAppBar remain hidden in detail fragment (selected item) of recyclerview #3519

@USisFounderOfISIS

Description

@USisFounderOfISIS

Description: app:hideOnScroll="true" works fine in Recyclerview scroll. But when I
scroll the recyclerview until BottomAppBar become hidden and select an item of recyclerview and go to detail fragment (while BottomAppBar is hidden) then in Detail fragment BottomAppBar is also hidden. performShow or slideUp does nothing.

Expected behavior: I want the BottomAppBar become visible in selected item/detail fragment.

Source code:

<?xml version="1.0" encoding="utf-8"?>
<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/layout_main"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <com.google.android.material.appbar.MaterialToolbar
        android:id="@+id/appToolbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:backgroundTint="@color/green_900"
        app:collapseIcon="@drawable/ic_gear"
        app:navigationIcon="@drawable/ic_arrow_right"
        app:navigationIconTint="@color/white"
        app:titleCentered="true"
        app:titleTextAppearance="@style/TitleFont" />

    <fragment
        android:id="@+id/navHostFragment"
        android:name="androidx.navigation.fragment.NavHostFragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="center"
        android:layout_weight="1"
        app:defaultNavHost="true"
        app:navGraph="@navigation/main_graph" />

    <com.google.android.material.bottomappbar.BottomAppBar
        android:id="@+id/mainBottomAppBar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        app:backgroundTint="@color/green"
        app:collapseIcon="@drawable/ic_cancel"
        app:elevation="@dimen/responsive_card_view_elevation_huge"
        app:fabAlignmentMode="center"
        app:fabAnimationMode="scale"
        app:fabCradleMargin="@dimen/responsive_app_logo_corner_radius"
        app:layout_behavior="com.google.android.material.behavior.HideBottomViewOnScrollBehavior"
        app:hideOnScroll="true"
        app:layout_anchorGravity="bottom"
        app:menu="@menu/user_main_fragment_menu"
        app:navigationIcon="@drawable/ic_menu_selector"
        app:navigationIconTint="@color/white" />

    <com.google.android.material.floatingactionbutton.FloatingActionButton
        android:id="@+id/main_fab"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/ic_two_gears"
        app:backgroundTint="@color/green"
        app:borderWidth="0dp"
        app:elevation="@dimen/responsive_card_view_elevation_huge"
        app:fabSize="normal"
        app:layout_anchor="@id/mainBottomAppBar"
        app:layout_anchorGravity="center" />

    <LinearLayout
        android:id="@+id/mainActivityLinearLayout"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_gravity="bottom"
        android:orientation="vertical"/>

</androidx.coordinatorlayout.widget.CoordinatorLayout>

Android API version: Device API 23 - Compile SDK version 33

Material Library version: 1.9.0

Device: 4.65 720p (Galaxy Nexus) API 23. (Android Studio Emulator)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions