Android的 - 编程方式选择菜单选项 [英] Android - Programmatically select menu option

查看:73
本文介绍了Android的 - 编程方式选择菜单选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法以编程方式选择菜单选项?基本上,我想在一个视图中的按钮执行相同的操作为pressing一个特定的菜单选项。我想试图调用onOptionsItemSelected(菜单项项目),但我不知道该怎么把菜单项。

Is there a way to programmatically select a menu option? Basically, I want a button in a view to perform the same action as pressing a specific menu option. I was thinking of trying to call onOptionsItemSelected(MenuItem item) but I don't know what to put for the menu item.

推荐答案

你为什么不兼得UI事件调用常用的方法?

Why don't you have both UI events call a common method?

这篇关于Android的 - 编程方式选择菜单选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆