Hide item from popupmenu

前端 未结 2 1401
隐瞒了意图╮
隐瞒了意图╮ 2020-12-18 18:07

I created a popup menu. I need to hide a particular item from popup menu on condition, I tried this below code but it doesn\'t work and shows \"unexpectedly your app has

2条回答
  •  北荒
    北荒 (楼主)
    2020-12-18 18:15

    This answer may be helpful to someone,

    I used below

    popupMenu.getMenu().findItem(R.id.next).setVisible(true);
    

    If you want to change the text of the menu, you can use below code,

    popupMenu.getMenu().findItem(R.id.next).setTitle("After");
    

提交回复
热议问题