I\'m using BottomNavigationView with using Android Support Desing Library 25. But when I switch the tabs, the other tab\'s title is hiding. But there is no hiding issue actu
I pretty much used rafsanahmad007 answer but translate it to Kotlin. Let me share it for the future wanderers
@SuppressLint("RestrictedApi")
fun BottomNavigationView.disableShiftMode() {
val menuView = this.getChildAt(0) as BottomNavigationMenuView
try {
val shiftingMode = menuView::class.java.getDeclaredField("mShiftingMode")
shiftingMode.setAccessible(true)
shiftingMode.setBoolean(menuView, false)
shiftingMode.setAccessible(false)
for (i in 0..(menuView.childCount - 1)) {
val item = menuView.getChildAt(i) as BottomNavigationItemView
item.setShiftingMode(false)
// set once again checked value, so view will be updated
item.setChecked(item.getItemData().isChecked())
}
} catch (e: NoSuchFieldException) {
Timber.e("Unable to get shift mode field")
} catch (e: IllegalAccessException) {
Timber.e("Unable to change value of shift mode")
}
}