开发者

Android context menu custom positioning?

开发者 https://www.devze.com 2023-03-09 09:40 出处:网络
I have managed to do this for Toasts and Dialog boxes, but now the trouble of context menu has arisen. Is it possible in Android to position a context menu to a different location programmatically? I

I have managed to do this for Toasts and Dialog boxes, but now the trouble of context menu has arisen. Is it possible in Android to position a context menu to a different location programmatically? I want to be able to specify the position anywhere on the screen as part of a custom user interface, but I cannot seem开发者_如何学运维 to figure out how to do this. Thanks in advance.


As I noted in my comment, I went with a PopupWindow for the actual menu view. It contained a ListView for the menu items with appropriate event listeners. I attached the context menu by overriding the long press listener and adding the PopupWindow at event.getRawY().

0

精彩评论

暂无评论...
验证码 换一张
取 消