android submenu
16lz
2021-12-04
Submenus
A sub menu can be added within any menu, except another sub menu. These are very useful when your application has a lot of functions that may be organized in topics, like the items in a PC application's menu bar (File, Edit, View, etc.).
A sub menu is created by adding it to an existingMenu
with
. This returns aaddSubMenu()
SubMenu
object (an extension ofMenu
). You can then add additional items to this menu, with the normal routine, using the
methods. For example:add()
- publicbooleanonCreateOptionsMenu(Menumenu){
- booleanresult=super.onCreateOptionsMenu(menu);
- //设置子菜单的名称
- SubMenufileMenu=menu.addSubMenu("File");
- SubMenueditMenu=menu.addSubMenu("Edit");
- //按对应的名称增加子菜单
- fileMenu.add("new");
- fileMenu.add("open");
- fileMenu.add("save");
- editMenu.add("undo");
- editMenu.add("redo");
- returnresult;
- }
更多相关文章
- Android(安卓)菜单资源
- android中颜色对应的值
- Android(安卓)WIFI DEMO(扫描附近WIFI强度)
- Android分页控件xlistview
- android基础控件(3)BottomNavigationView+FragmentLayout实现底层
- android的一个编译问题
- Android名称、版本和API level的对应关系
- Android(安卓)SDcard 文件读写,RandomAccessFile操作
- android 创建快捷方式
随机推荐
- Android深入浅出系列课程---Lesson3 AAF1
- 在eclipse中查看android SDK的源代码
- Android(安卓)5.0 MaterialDesign Ripple
- 编译Android内核
- android 动态壁纸 3 解决 动态壁纸列表界
- 使用Bottom Navigation Activity实现Andr
- 【Android】android:windowSoftInputMode
- This Android(安卓)SDK requires Android
- Android中shape属性详解:(设置圆角、设置渐
- [Android(安卓)Training视频系列]1.1 Cre