diff --git a/docs/html/guide/topics/resources/menu-resource.jd b/docs/html/guide/topics/resources/menu-resource.jd
index 7bcd78a5196d6..33c782b1c0530 100644
--- a/docs/html/guide/topics/resources/menu-resource.jd
+++ b/docs/html/guide/topics/resources/menu-resource.jd
@@ -39,7 +39,10 @@ In XML: @[package:]menu.filename
android:title="string"
android:titleCondensed="string"
android:icon="@[package:]drawable/drawable_resource_name"
+ android:onClick="method name"
android:showAsAction=["ifRoom" | "never" | "withText" | "always"]
+ android:actionLayout="@[package:]layout/layout_resource_name"
+ android:actionViewClass="class name"
android:alphabeticShortcut="string"
android:numericShortcut="string"
android:checkable=["true" | "false"]
@@ -74,8 +77,8 @@ In XML: @[package:]menu.filename
attributes:
xmlns:android"http://schemas.android.com/apk/res/android".
+ "http://schemas.android.com/apk/res/android".
@[package:]menu.filename
"@+id/name". The plus symbol indicates that this should be created as a new
ID.
android:titleandroid:titleCondensedandroid:iconandroid:onClickWarning: If you obfuscate your code using ProGuard (or a similar tool), +be sure to exclude the method you specify in this attribute from renaming, because it can break the +functionality.
+Introduced in API Level HONEYCOMB.
android:showAsActionIntroduced in API Level HONEYCOMB.
android:actionViewLayoutSee Using the Action Bar for +more information.
+Introduced in API Level HONEYCOMB.
android:actionViewClassNameSee Using the Action Bar for +more information.
+Warning: If you obfuscate your code using ProGuard (or a similar tool), +be sure to exclude the class you specify in this attribute from renaming, because it can break the +functionality.
+Introduced in API Level HONEYCOMB.
android:alphabeticShortcutandroid:numericShortcutThis application code will inflate the menu from the {@link -android.app.Activity#onCreateOptionsMenu(Menu)} callback:
+The following application code inflates the menu from the {@link +android.app.Activity#onCreateOptionsMenu(Menu)} callback and also declares the on-click +callback for two of the items:
public boolean onCreateOptionsMenu(Menu menu) {
- MenuInflater inflater = getMenuInflater();
- inflater.inflate(R.menu.example_menu, menu);
- return true;
+ MenuInflater inflater = getMenuInflater();
+ inflater.inflate(R.menu.example_menu, menu);
+ return true;
+}
+
+public void onGroupItemClick(MenuItem item) {
+ // One of the group items (using the onClick attribute) was clicked
+ // The item parameter passed here indicates which item it is
+ // All other menu item clicks are handled by {@link android.app.Activity#onOptionsItemSelected onOptionsItemSelected()}
}
Note: The {@code android:showAsAction} attribute is