Android ActionBar action bar
ActionBar action bar
I. ActionBar: (action bar)
(1) Introduction: (Extended TitleBar)
Action bar is a navigation control that replaces the title bar at the top of a traditional screen. ActionBar is a control displayed on the top of the screen. It includes the logo icon of the application displayed on the left and visible items of the Right Operation menu. Similar to the toolbar of a windows desktop program.
Effect: vcq9o6y/examples/ejqMjnobDXorLhobEsobC1x8K8obGhoqGwy9HL96GxLA = "). Display the hidden option menu as an ActionItem.
The above summary: The Action bar replaces the tittle bar and menu before 3.0.
Figure 1. The operation column in the Honeycomb Gallery application, starting from the left, is the logo, navigation option label, and Operation item (a floating menu button inserted on the right ).
Note: If you "re looking for information about the contextual action bar for displaying contextual action items, see the Menu guide.
Action Bar Design For design guidelines, read Android Design's Action Bar guide.
2. The ActionBar is divided into four areas:
- App Icon: displays the icon of the APP, which can be replaced by other icons. When the software is not on the top page, a left arrow is displayed on the left of the icon. You can use this arrow to navigate up.
- View switching: (effects are shown in figure)
- Action Buttons: This is the most important software function. A button that cannot be placed automatically enters Action overflow.
- Action overflow: an uncommon operation item automatically enters Action OverFlow
[Note:] What is Action overflow?
For mobile phones without MENU buttons, The ActionBar will display a collapsed icon at the end. Clicking this icon will display the remaining option MENU items. The collapsed icon function is Action overflow.
Operations that are not frequently used in Action overflow. According to the official website, "the Overflow icon is only displayed on a mobile phone without a MENU key, but not on a mobile phone with a MENU key, the MENU button is displayed." In fact, Google has urged mobile phone manufacturers and software developers to cancel the MENU. That is, the previous Menu will not be used.
(3). ActionBar Creation Principles:
①. Frequently used: it is frequently used by users, for example, the "New SMS" menu item in the text message application. ②. important: operations that are very important to users, such as "Creating a network" in Wi-Fi settings ". ③. typical: This action item is provided in similar applications, such as "new contact" in the Contact application"
(2) create an ActionBar:
1. Define menu in the XML resource file. You can also have common menus, secondary common menus, and secondary optional menus.
android:id="@+id/menu_about"
android:orderInCategory="2"
android:showAsAction="never"
Android: title = "about"/>
[Note: android: showAsAction attributes include never, always, ifRoom, withText, and collapseActionView]
Android: showAsAction attribute value explanation: