Contrôle PopupMenu dans le double écran Fluent UI

Les menus contextuels sont ancrés, ce qui évite leur affichage sous la charnière :

Surface Duo montrant un menu contextuel

Pour utiliser le contrôle PopupMenu de Fluent UI, PopupMenu, puis importez les classes nécessaires :

import com.microsoft.fluentui.popupmenu.PopupMenu
import com.microsoft.fluentui.popupmenu.PopupMenuItem

Menu contextuel simple

val popupMenuItems = arrayListOf(
    PopupMenuItem(R.id.popup_menu_item_share, "Share"),
    PopupMenuItem(R.id.popup_menu_item_follow, "Follow"),
    PopupMenuItem(R.id.popup_menu_item_invite_people, "Invite people"),
    PopupMenuItem(R.id.popup_menu_item_refresh_page, "Refresh page"),
    PopupMenuItem(R.id.popup_menu_item_open_in_browser, "Open in browser"),
    PopupMenuItem(R.id.popup_menu_item_multiline, "This is a multiline popup menu. Max lines are set to two...")
)
val onPopupMenuItemClickListener = object : PopupMenuItem.OnClickListener {
    override fun onPopupMenuItemClicked(popupMenuItem: PopupMenuItem) {
        // handle click here
    }
}
showPopupMenu(anchorView, popupMenuItems, PopupMenu.ItemCheckableBehavior.NONE, onPopupMenuItemClickListener)