Home > other >  How to remove the toast like popup in BottomNavigationView when long press the item?
How to remove the toast like popup in BottomNavigationView when long press the item?

Time:04-18

How to remove the toast like popup in material bottom navigation view BottomNavigationView occurs when we long press the single item .The demo image attached belowenter image description here

CodePudding user response:

That is tooltip, It can be disabled by calling TooltipCompat.setTooltipText(view, null) on each menu item.

bottomNavigationView
    .menu.forEach {
            TooltipCompat.setTooltipText(bottomNavigationView.findViewById<View>(it.itemId), null)
        }

There's a possible chance that the above code won't work, when the bottomNavigatinView sets the tooltip text after you set it as null. You can override the longClickListener on the menu item itself, so it won't show a tooltip text.

bottomNavigationView
    .menu.forEach {
        bottomNavigationView.findViewById<View>(it.itemId).setOnLongClickListener {
            // add any code which you want to execute on long click
            true
            }
    }
  • Related