Modifying this control will update this page automatically
The menu bar runs along the top of the screen on your Mac. Use the menus and icons in the menu bar to choose commands, perform tasks, and check status. You can set an option to automatically hide the menu bar so it’s shown only when you move the pointer to the top of the screen. See Change Dock & Menu Bar preferences. Apple menuThe Apple menu , located in the top-left corner of the screen, contains commands for things you do frequently, such as update apps, open System Preferences, lock your screen, or shut down your Mac. See What’s in the Apple menu? App menusApp menus are located next to the Apple menu. The name of the app you’re using appears in bold, followed by other menus, often with standard names such as File, Edit, Format, or Window. Each app has a Help menu to make it easy to get information about using the app. See Use the built-in help. Each menu contains commands, many of which are available in most apps. For example, the Open command is often in the File menu. For information about the symbols used in the keyboard shortcuts that are shown in the menu commands, see What are those symbols shown in menus? Status menusToward the right end of the menu bar are items (sometimes called status menus), typically represented by icons, that let you check the status of your Mac (such as the battery charge) or customize features (such as keyboard brightness). To show more details or options, click a status menu icon. For example, click Wi-Fi to show a list of available networks, or click Display to turn Dark Mode or Night Shift on or off. You can choose which items to show in the menu bar.To rearrange status menus, press and hold the Command key while you drag an icon. To quickly remove a status menu, press and hold the Command key while you drag the icon out of the menu bar. SpotlightIf the Spotlight icon is shown in the menu bar, click the icon to search for items on your Mac and the web. See Search with Spotlight.Control CenterClick the Control Center icon to open Control Center, where you can access features you use often, such as AirDrop, AirPlay, Focus, and more. See Use Control Center.SiriIf the Siri icon is shown in the menu bar, click the icon to use Siri to do things like open files or apps, or to find things on your Mac or on the internet. See Use Siri.Notification CenterAt the right end of the menu bar, click the date and time to open Notification Center, where you can view appointments, notes, weather, and more, and catch up on notifications you missed. See Use Notification Center.
Please don’t include any personal information in your comment. Maximum character limit is 250. Thanks for your feedback. Menus are a common user interface component in many types of applications. To provide a familiar and consistent user experience, you should use the Beginning with Android 3.0 (API level 11), Android-powered devices are no longer required to provide a dedicated Menu button. With this change, Android apps should migrate away from a dependence on the traditional 6-item menu panel and instead provide an app bar to present common user actions. Although the design and user experience for some menu items have changed, the semantics to define a set of actions and options is still based on the See the section about Creating an Options Menu. Context menu and contextual action modeA context menu is a floating menu that appears when the user performs a long-click on an element. It provides actions that affect the selected content or context frame.The contextual action mode displays action items that affect the selected content in a bar at the top of the screen and allows the user to select multiple items. See the section about Creating Contextual Menus. Popup menuA popup menu displays a list of items in a vertical list that's anchored to the view that invoked the menu. It's good for providing an overflow of actions that relate to specific content or to provide options for a second part of a command. Actions in a popup menu should not directly affect the corresponding content—that's what contextual actions are for. Rather, the popup menu is for extended actions that relate to regions of content in your activity.See the section about Creating a Popup Menu. Defining a Menu in XMLFor all menu types, Android provides a standard XML format to define menu items. Instead of building a menu in your activity's code, you should define a menu and all its items in an XML menu resource. You can then inflate the menu resource (load it as a Using a menu resource is a good practice for a few reasons:
To define the menu, create an XML file inside your project's <menu> Defines a Menu , which is a container for menu items. A <menu> element must be the root node for the file and can hold one or more <item> and <group> elements.<item> Creates a MenuItem , which represents a single item in a menu. This element may contain a nested <menu> element in order to create a submenu.<group> An optional, invisible container for <item> elements. It allows you to
categorize menu items so they share properties such as active state and visibility. For more information, see the section about Creating Menu Groups.Here's an example menu named <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@+id/new_game" android:icon="@drawable/ic_new_game" android:title="@string/new_game" android:showAsAction="ifRoom"/> <item android:id="@+id/help" android:icon="@drawable/ic_help" android:title="@string/help" /> </menu> The android:id
A resource ID that's unique to the item, which allows the application to recognize the item when the user selects it.android:icon A reference to a drawable to use as the item's icon.android:title A reference to a string to use as the item's title.android:showAsAction Specifies when and how this item should appear as an action item in the app bar.These are the most important attributes you should use, but there are many more available. For information about all the supported attributes, see the Menu Resource document. You can add a submenu to an item in any menu by adding a <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@+id/file" android:title="@string/file" > <!-- "file" submenu --> <menu> <item android:id="@+id/create_new" android:title="@string/create_new" /> <item android:id="@+id/open" android:title="@string/open" /> </menu> </item> </menu> To use the menu in
your activity, you need to inflate the menu resource (convert the XML resource into a programmable object) using Figure 1. Options menu in the Browser. The options menu is where you should include actions and other options that are relevant to the current activity context, such as "Search," "Compose email," and "Settings." Where the items in your options menu appear on the screen depends on the version for which you've developed your application:
Figure 2. The Google Sheets app, showing several buttons, including the action overflow button. You can declare items for the options menu from either your To specify the options menu for an activity, override
You can also add menu items using If you've
developed your application for Android 2.3.x and lower, the system calls When the user selects an item from the options menu (including action items in the app bar), the system calls your activity's
When you successfully handle a menu item, return If your activity includes fragments, the system first calls Tip: Android 3.0 adds the ability for you to define the on-click behavior for a menu item in XML, using the Tip: If your application contains multiple activities and some of
them provide the same options menu, consider creating an activity that implements nothing except the After the system calls If you want to modify the options menu based on events that occur during the activity
lifecycle, you can do so in the On Android 2.3.x and lower, the system calls On Android 3.0 and higher, the options menu is considered to always be open when menu items are presented in the app bar. When an
event occurs and you want to perform a menu update, you must call Note: You should never change items in the options menu based on the Figure 3. Screenshots of a floating context menu (left) and the contextual action bar (right). A
contextual menu offers actions that affect a specific item or context frame in the UI. You can provide a context menu for any view, but they are most often used for items in a There are two ways to provide contextual actions:
Note: The contextual action mode is available on Android 3.0 (API level 11) and higher and is the preferred technique for displaying contextual actions when available. If your app supports versions lower than 3.0 then you should fall back to a floating context menu on those devices. To provide a floating context menu:
Using the contextual action modeThe contextual action mode is a system implementation of Note: The contextual action bar is not necessarily associated with the app bar. They operate independently, even though the contextual action bar visually overtakes the app bar position. For views that provide contextual actions, you should usually invoke the contextual action mode upon one of two events (or both):
How your application invokes the contextual action mode and defines the behavior for each action depends on your design. There are basically two designs:
The following sections describe the setup required for each scenario. Enabling the contextual action mode for individual viewsIf you want to invoke the contextual action mode only when the user selects specific views, you should:
For example:
Enabling batch contextual actions in a ListView or GridViewIf you have a collection of items in a
For example:
That's it. Now when the user selects an item with a long-click, the system calls the In some cases in which the contextual actions provide common action items, you might want to add a checkbox or a similar UI element that allows users to select items, because they might not discover the long-click behavior. When a user selects the checkbox, you can invoke the contextual action mode by setting the respective list item to the checked state with Figure 4. A popup menu in the Gmail app, anchored to the overflow button at the top-right. A
Note: If you define your menu in XML, here's how you can show the popup menu:
For example, here's a button with the <ImageButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/ic_overflow_holo_dark" android:contentDescription="@string/descr_overflow_button" android:onClick="showPopup" /> The activity can then show the popup menu like this:
In API level 14 and higher, you can combine the two lines that inflate the menu with The menu is dismissed when the user selects an item or touches outside the menu area. You can listen for the dismiss event using To perform an action when the user selects a menu item, you must implement the For example:
Creating Menu GroupsA menu group is a collection of menu items that share certain traits. With a group, you can:
You can create a group by nesting Here's an example menu resource that includes a group: <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@+id/menu_save" android:icon="@drawable/menu_save" android:title="@string/menu_save" /> <!-- menu group --> <group android:id="@+id/group_delete"> <item android:id="@+id/menu_archive" android:title="@string/menu_archive" /> <item android:id="@+id/menu_delete" android:title="@string/menu_delete" /> </group> </menu> The items that are in the group appear at the same level as the first item—all three items in the menu are siblings. However, you can modify the traits of the two items in the group by referencing the group ID and
using the methods listed above. The system will also never separate grouped items. For example, if you declare Using checkable menu itemsFigure 5. Screenshot of a submenu with checkable items. A menu can be useful as an interface for turning options on and off, using a checkbox for stand-alone options, or radio buttons for groups of mutually exclusive options. Figure 5 shows a submenu with items that are checkable with radio buttons. Note: Menu items in the Icon Menu (from the options menu) cannot display a checkbox or radio button. If you choose to make items in the Icon Menu checkable, you must manually indicate the checked state by swapping the icon and/or text each time the state changes. You can define the checkable behavior for individual menu items using the <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android"> <group android:checkableBehavior="single"> <item android:id="@+id/red" android:title="@string/red" /> <item android:id="@+id/blue" android:title="@string/blue" /> </group> </menu> The single Only one item from the group can be checked (radio buttons)all All items can be
checked (checkboxes)none No items are checkableYou can apply a default checked state to an item using the When a checkable item is selected, the system calls your respective item-selected callback method (such as
If you don't set the checked state this way, then the visible state of the item (the checkbox or radio button) will not change when the user selects it. When you do set the state, the activity preserves the checked state of the item so that when the user opens the menu later, the checked state that you set is visible. Note: Checkable menu items are intended to be used only on a per-session basis and not saved after the application is destroyed. If you have application settings that you would like to save for the user, you should store the data using Shared Preferences. Adding Menu Items Based on an IntentSometimes you'll want a menu item to launch an activity using an However, if you are not certain that the user's device contains an application that handles the intent, then adding a menu item that invokes it can result in a non-functioning menu item, because the intent might not resolve to an activity. To solve this, Android lets you dynamically add menu items to your menu when Android finds activities on the device that handle your intent. To add menu items based on available activities that accept an intent:
If there are no applications installed that satisfy the intent, then no menu items are added. Note: For example:
For each activity found that provides an intent filter matching the intent defined, a menu item is added, using the value in the intent filter's Note: When you call Allowing your activity to be added to other menusYou can also offer the services of your activity to other applications, so your application can be included in the menu of others (reverse the roles described above). To be included in other application menus, you need to define an intent filter as usual, but be sure to include the <intent-filter label="@string/resize_image"> ... <category android:name="android.intent.category.ALTERNATIVE" /> <category android:name="android.intent.category.SELECTED_ALTERNATIVE" /> ... </intent-filter> Read more about writing intent filters in the Intents and Intent Filters document. What is a location on the monitor screen to mouse click and perform many different operations?ICON/BUTTON: A location on the monitor screen to mouse click and perform many different operations. INDENT: A feature that sets a tab that indents a paragraph.
What is an mis stroke of a key?any misstroke of a key; also any variation between source copy and displayed or printed copy; departure from acceptable format. Error: key on the keyboard that is used to exit a program.
What is a key that when depressed immediately before or as another key is stuck causes that key to perform a special function?ALT: a key that when depressed immediately before or as another key is stuck causes that key to perform a special function. ALIGNMENT: formatting of a paragraph to align with the left margin, right margin, centered, or both margins.
Which key is pressed as another key is struck to make capital letters and certain symbols?Press Shift in combination with a letter to type an uppercase letter. Press Shift in combination with another key to type the symbol shown on the upper part of that key. Press Caps Lock once to type all letters as uppercase. Press Caps Lock again to turn this function off.
|