aurelhubert / ahbottomnavigation

A library to reproduce the behavior of the Bottom Navigation guidelines from Material Design.
3.84k stars 684 forks source link

Hide BottomNavigation when replacing fragment #322

Open deshario opened 6 years ago

deshario commented 6 years ago

I'm replacing fragment from my custom adapter ... when i replace fragment how should i remove or hide AHBottomNavigation still that replaced fragment is active ... or should i customize my xml layout .... Is there any way to do that ... #Thankx

XML

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true" android:id="@+id/mainbox">

<android.support.design.widget.AppBarLayout
    android:id="@+id/appbar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@color/material_red"
    app:theme="@style/ThemeOverlay.AppCompat.Light"
    app:elevation="0dp">

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        app:popupTheme="@style/AppTheme.AppBarOverlay"
        app:theme="@style/ToolbarColoredBackArrow"
        app:titleTextColor="@android:color/white"/>

</android.support.design.widget.AppBarLayout>

<FrameLayout
    android:id="@+id/frame_container"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_above="@+id/bottom_navigation"
    android:layout_below="@+id/appbar"
    android:background="@android:color/transparent" />

<com.aurelhubert.ahbottomnavigation.AHBottomNavigation
    android:id="@+id/bottom_navigation"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true" />

CODE FragmentManager fragmentManager = ((FragmentActivity) context).getSupportFragmentManager(); FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); fragmentTransaction.setCustomAnimations(android.R.anim.fade_in, android.R.anim.fade_out); fragmentTransaction.replace(R.id.frame_container, new SavedReq_frag(),MYTAG); fragmentTransaction.addToBackStack(null); fragmentTransaction.commit();