Menu:
android.view.Menu |
Known Indirect Subclasses |
原意:
Interface for managing the items in a menu. By default, every Activity supports an options menu of actions or options. You can add items to this menu and handle clicks on your additions. The easiest way of adding menu items is inflating an XML file into the Menu via MenuInflater. The easiest way of attaching code to clicks is via onOptionsItemSelected(MenuItem) and onContextItemSelected(MenuItem).
译文:
Menu是一个接口,管理着菜单中的选项。默认情况下,每一个Activity都支持的一个可选菜单活动或选项菜单。您可以添加一个选项到该菜单和给它添加点击功能。添加菜单项的最简单的方法是通过解析xml文件。通过代码实现的最简单方式是添加onOptionsItemSelected(菜单项)和onContextItemSelected(菜单项)。
代码示例:
效果显示: