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.
在 Android 中,当用户想要显示上下文菜单时,他们需要长按某些控件。之后,onCreateContextMenu运行回调以在屏幕上创建上下文菜单。但是有没有听众知道上下文菜单何时完全呈现?
onCreateContextMenu
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { menu.add(0, v.getId(), 0, "Something"); menu.add(0, v.getId(), 0, "Something else"); }
这里 menu.add 将返回 MenuItem 并且最后一个菜单项将指示上下文菜单已完全呈现。