答案 0 :(得分:2)
如果你需要那个,你需要设置ShiftMode如下:
public static void disableShiftMode(BottomNavigationView view) {
BottomNavigationMenuView menuView = (BottomNavigationMenuView) view.getChildAt(0);
try {
Field shiftingMode = menuView.getClass().getDeclaredField("mShiftingMode");
shiftingMode.setAccessible(true);
shiftingMode.setBoolean(menuView, false);
shiftingMode.setAccessible(false);
} catch (NoSuchFieldException e) {
Log.e("BNVHelper", "Unable to get shift mode field", e);
} catch (IllegalAccessException e) {
Log.e("BNVHelper", "Unable to change value of shift mode", e);
}
}
发送你的Buttom NavigationView:
BottomNavigationView bottomNavigationView = (BottomNavigationView) findViewById(R.id.navigation);
disableShiftMode(bottomNavigationView);
这就是谢谢你。