'showContextMenu shows drop down menu instead of floating menu
I want to show context menu on single click on a View, I'm using:
view.setOnClickListener {
it.setOnCreateContextMenuListener { menu, view, contextMenuInfo ->
menu.add("1")
menu.add("2")
menu.add("3")
}
it.showContextMenu()
}
But this code shows context menu in the center of the screen (like drop down list instead of floating menu).
showContextMenu(float x, float y) Shows near the view, but it support only api 24+.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
