android菜单点击功能怎么做的,单击android中的Menu按钮打开上下文菜单
Are you sure you want to open context Menu on Click of Menu button?
因为,上下文菜单适用于特定视图,
上下文菜单提供影响UI中特定项目或上下文框架的操作.您可以为任何视图提供上下文菜单,但它们通常用于ListView,GridView或其他视图集合中的项目,用户可以在其中对每个项目执行直接操作.
要在长按下显示上下文菜单,大多数客户端将要调用registerForContextMenu(View)并覆盖onCreateContextMenu(ContextMenu,View,ContextMenu.ContextMenuInfo).
对于设备的菜单按钮,您可以使用Options Menu
更新:
我从来没有试过这个,但你可以做点什么,
>处理菜单按钮按下设备事件,
public boolean onKeyUp(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_MENU) {
// ........
}
return true;
}
>把线放进去,
this.openContextMenu(view); // Here view is reference for which you have a register contect menu..
总结
以上是生活随笔为你收集整理的android菜单点击功能怎么做的,单击android中的Menu按钮打开上下文菜单的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: android系统中sd卡各文件夹功能详
- 下一篇: android mat下载地址,MatL