Closed jrcacd closed 5 years ago
Hi, how would those disabled items look and behave?
Perhaps have an grayed icon and not execute the callback code.
So clicking on such an item would also not dismiss the popup window?
Regarding the UI of a disabled item it's possible by using an item with a custom layout. As far as the on-click behaviour is concerned, this might a bit more tricky. I'd probably try to disable the item in viewBoundCallback
and see if that works.
You could have the following:
val popupMenu = popupMenu {
section {
// ...
customItem {
layoutResId = R.layout.you_disabled_item_layout
viewBoundCallback = { view ->
view.isEnabled = false
}
}
}
}
popupMenu.show(context, view)
Adding view.isEnabled = false
should be enough to disable onClick events.
Umm, ok, but a litle tricky
We need that some menu entries be visible, but be disabled because some users do not have sufficient permissions.