How to disable BottomNavigationView shift mode?

后端 未结 21 2251
Happy的楠姐
Happy的楠姐 2020-11-22 15:55

BottomNavigationView doesn\'t show menu\'s title that are inactive.

How to show titles of all menu elements in bottomNavigationBar? The problem is that in my case s

21条回答
  •  没有蜡笔的小新
    2020-11-22 16:43

    I had some weird behavior with BottomNavigationView. When I was selecting any item/fragment in it, the fragment pushes BottomNavigationView a bit lower, so text of BottomNavigationView goes below the screen, so only icons were visible and text goes hidden on clicking of any item.

    If you are facing that weird behavior then Here is the solution. Just remove

    android:fitsSystemWindows="true"
    

    in your root layout of fragment. Just remove this and boom! BottomNavigationView will work fine, now it can be shown with text and icon. I had this in my root CoordinatorLayout of fragment.

    Also don't forget to add

    BottomNavigationViewHelper.disableShiftMode(bottomNavigationView);
    

    in your activity to disable shifting mode. Though it is not exactly related to the asked question, but still I find this helpful.

提交回复
热议问题