- Android Application Development Cookbook(Second Edition)
- Rick Boyer Kyle Mew
- 218字
- 2021-07-09 19:36:24
Introduction
The Android OS is an ever-changing environment. The earliest Android devices (prior to Android 3.0), were required to have a hardware menu button. Though a hardware button is no longer required, menus are no less important. In fact, the Menu API has expanded to now support three different types of menus:
- Options Menu and Action Bar: This is the standard menu, which is used for global options of your application. Use this for additional features such as search, settings, and so on.
- Contextual Mode (Contextual Action Mode): This is generally activated by long press. (Think of this as similar to a right-click on the desktop.) This is used to take an action on the pressed item, such as replying to an e-mail or deleting a file.
- Pop-up Menu: This provides a pop-up selection (like a spinner) for an additional action. The menu options are not meant to affect the item pressed, instead use Contextual Mode as described previously. An example would be hitting the share button and getting an additional list of share options.
Menu resources are similar to other Android UI components; they are generally created in XML, but can be created in code as well. Our first recipe, as shown in the following section, will show the XML menu format and how to inflate it.
推薦閱讀
- HTML5移動Web開發技術
- Learning Docker
- The React Workshop
- HTML5+CSS3+JavaScript Web開發案例教程(在線實訓版)
- Ext JS 4 Web Application Development Cookbook
- 大學計算機基礎實驗指導
- Python Data Analysis Cookbook
- Learning OpenStack Networking(Neutron)
- SQL Server數據庫管理與開發兵書
- Web前端應用開發技術
- 智能搜索和推薦系統:原理、算法與應用
- Image Processing with ImageJ
- Access 2010數據庫應用技術實驗指導與習題選解(第2版)
- 深入實踐Kotlin元編程
- Getting Started with Polymer