setMenuItemVisibility

open fun setMenuItemVisibility(@IdRes menuItemId: Int, visibility: Int): Boolean

Shows or hides a menu item if that menu item currently exists.

Return

true if the menu item exists and it's visibility was changed.

Parameters

menuItemId

ID of the menu item.

visibility

One of VISIBLE, INVISIBLE, or GONE.