简体   繁体   中英

How to enable BottomNavigationView's shifting mode

Its not duplicate of How to disable BottomNavigationView shift mode?

I'm using BottomNavigationView in my application but Shifting Mode not works , just shows ripple with no animation !

I tested this code but not helped !

 BottomNavigationMenuView menuView = (BottomNavigationMenuView) navigation.getChildAt(0);

  for (int i = 0; i < menuView.getChildCount(); i++) {
    BottomNavigationItemView item = (BottomNavigationItemView) menuView.getChildAt(i);
    item.setShifting(true);
  }
implementation 'com.android.support:design:28.0.0'

my xml :

    <android.support.design.widget.BottomNavigationView
        android:id="@+id/navigation"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_gravity="bottom"
        android:background="@color/blue_grey_700"
        app:menu="@menu/menu_bottom_navigation_shifting" />

What i want and my result !

Sifting mode is your default one. You no need to active shifting mode. If you want to remove shifting mode then you have to do some modification.

If you did any modification on BottomNavigationView object then remove it and try again.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM