Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
以前にやったことがあるので、それが可能であることは知っていますが、コードを失いました。タッチイベントからメニューを開きたい。開くには何を書く必要がありますか?もう本当にわからない。
onCreateContextMenu(ContextMenu, View, ContextMenu.ContextMenuInfo)オーバーライドしてアクティブにする必要がありますonContextItemSelect()。ロングクリックで表示したい場合は、 を呼び出しますregisterForContextMenu(View)。ビューをクリックして手動で表示したい場合はopenContextMenu()、onClick() を呼び出します。
onCreateContextMenu(ContextMenu, View, ContextMenu.ContextMenuInfo)
onContextItemSelect()
registerForContextMenu(View)
openContextMenu()