android hide and show bottom navigation

public class BottomNavigationViewBehavior extends CoordinatorLayout.Behavior<BottomNavigationView> {

private int height;

@Override
public boolean onLayoutChild(CoordinatorLayout parent, BottomNavigationView child, int layoutDirection) {
    height = child.getHeight();
    return super.onLayoutChild(parent, child, layoutDirection);
}

@Override
public boolean onStartNestedScroll(@NonNull CoordinatorLayout coordinatorLayout,
                               BottomNavigationView child, @NonNull 
                               View directTargetChild, @NonNull View target,
                               int axes, int type)
{
    return axes == ViewCompat.SCROLL_AXIS_VERTICAL;
}

@Override
public void onNestedScroll(@NonNull CoordinatorLayout coordinatorLayout, @NonNull BottomNavigationView child,
           @NonNull View target, int dxConsumed, int dyConsumed,
           int dxUnconsumed, int dyUnconsumed, 
            @ViewCompat.NestedScrollType int type)
{
   if (dyConsumed > 0) {
       slideDown(child);
   } else if (dyConsumed < 0) {
       slideUp(child);
   }
}

private void slideUp(BottomNavigationView child) {
    child.clearAnimation();
    child.animate().translationY(0).setDuration(200);
}

private void slideDown(BottomNavigationView child) {
    child.clearAnimation();
    child.animate().translationY(height).setDuration(200);
}

Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
android hide and show bottom navigation show hide fragment on bottom navigation android hide bottom nav on scroll hide show bottom navigation bar android how to hide bottom navigation bar in a fragment android hide bottom nav using motion layout android studio how to hide bottom bar in android showing and hiding android hide system bottom navigation bar how to hide bottom bar in android how to hide bottom navigation bar in android programmatically in fragment Hide bottom navigation view android bottom navigation bar on hide android ANDROID + hide bottom navigation bar android studio hide bottom bar how to auto hide bottom navigation bar in android android show and hide bottom navigation bar how to hide android bottom bar hide top bar android activity android when nav upp with bottom hidden it keep hide android show bottom bar hiden by scroll how to hide bottom navigation bar in android programmatically how to hide bottom navigation buttons in android auto hide bottom navigation bar android hide bottom navigation bar android manually hide bottom bar android how to hide item in bottom menu in android android studio hide bottom navigation bar hide bottom navigation bar while scrolling kotlin android navigation bar hide scrolling view inside bottom navigation fragments scrolling activity in bottom navigation bottom navigation going down on scroll hide bottom navigation bar android while fragment transaction android hide bottom navigation menu item android activity no bottom navigation auto hide bar on scroll android signature android hide bottom menu bar hide show bottom navigation bar android using codnator layout how to hide bottom navigation bar android hide bottom navigation bar settings android hide bottom navigation bar hide bottom navigation bar android on scroll hide bottom navigation bar android how to hide bottom navigation bar in android bottomnavigationview hide on scroll android navigation component bottomnavigationview hide on scroll android bottomnavigationview hide on scroll hide bottom navigation bar in activity android scroll hide navigation android how to hide bottom navigation view on scroll how to get navigation visible while scrolling android bottom navigation bar scroll android bottom navigation bar should disappear when scrolled hide bottom navigation bar android while scrolling materila design bottom nav hide on scroll android how to hide bottom navigation bar in android studio change navigation layout behaviour android android meow navigation autohide hide bottom navigaton bar on scroll in android scrolling should hide bottom navigation bar android react native combine drawer and tab bottom navigation how to remove bounce animation on bottom navigation view in android
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source