Found the answer. In support library 28.0.0-alpha1 we can now add labels (remove shifting mode) using any one of the following methods:
XML:
<android.support.design.widget.BottomNavigationView
.
.
.
app:labelVisibilityMode="labeled" />
Code:
mBottomNavigationView.setLabelVisibilityMode(LabelVisibilityMode.LABEL_VISIBILITY_LABELED);
Or:
@SuppressLint("RestrictedApi")
public static void removeNavigationShiftMode(BottomNavigationView view) {
BottomNavigationMenuView menuView = (BottomNavigationMenuView) view.getChildAt(0);
menuView.setLabelVisibilityMode(LabelVisibilityMode.LABEL_VISIBILITY_LABELED);
menuView.buildMenuView();
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…