Skip to content

Most visited

Recently visited

navigation

SubMenu

public interface SubMenu
implements Menu

android.view.SubMenu


Subclass of Menu for sub menus.

Sub menus do not support item icons, or nested sub menus.

Developer Guides

For information about creating menus, read the Menus developer guide.

Summary

Inherited constants

From interface android.view.Menu

Public methods

abstract void clearHeader()

Clears the header of the submenu.

abstract MenuItem getItem()

Gets the MenuItem that represents this submenu in the parent menu.

abstract SubMenu setHeaderIcon(int iconRes)

Sets the submenu header's icon to the icon given in iconRes resource id.

abstract SubMenu setHeaderIcon(Drawable icon)

Sets the submenu header's icon to the icon given in icon Drawable.

abstract SubMenu setHeaderTitle(int titleRes)

Sets the submenu header's title to the title given in titleRes resource identifier.

abstract SubMenu setHeaderTitle(CharSequence title)

Sets the submenu header's title to the title given in title.

abstract SubMenu setHeaderView(View view)

Sets the header of the submenu to the View given in view.

abstract SubMenu setIcon(Drawable icon)

Change the icon associated with this submenu's item in its parent menu.

abstract SubMenu setIcon(int iconRes)

Change the icon associated with this submenu's item in its parent menu.

Inherited methods

From interface android.view.Menu

Public methods

clearHeader

Added in API level 1
void clearHeader ()

Clears the header of the submenu.

getItem

Added in API level 1
MenuItem getItem ()

Gets the MenuItem that represents this submenu in the parent menu. Use this for setting additional item attributes.

Returns
MenuItem The MenuItem that launches the submenu when invoked.

setHeaderIcon

Added in API level 1
SubMenu setHeaderIcon (int iconRes)

Sets the submenu header's icon to the icon given in iconRes resource id.

Parameters
iconRes int: The resource identifier used for the icon.
Returns
SubMenu This SubMenu so additional setters can be called.

setHeaderIcon

Added in API level 1
SubMenu setHeaderIcon (Drawable icon)

Sets the submenu header's icon to the icon given in icon Drawable.

Parameters
icon Drawable: The Drawable used for the icon.
Returns
SubMenu This SubMenu so additional setters can be called.

setHeaderTitle

Added in API level 1
SubMenu setHeaderTitle (int titleRes)

Sets the submenu header's title to the title given in titleRes resource identifier.

Parameters
titleRes int: The string resource identifier used for the title.
Returns
SubMenu This SubMenu so additional setters can be called.

setHeaderTitle

Added in API level 1
SubMenu setHeaderTitle (CharSequence title)

Sets the submenu header's title to the title given in title.

Parameters
title CharSequence: The character sequence used for the title.
Returns
SubMenu This SubMenu so additional setters can be called.

setHeaderView

Added in API level 1
SubMenu setHeaderView (View view)

Sets the header of the submenu to the View given in view. This replaces the header title and icon (and those replace this).

Parameters
view View: The View used for the header.
Returns
SubMenu This SubMenu so additional setters can be called.

setIcon

Added in API level 1
SubMenu setIcon (Drawable icon)

Change the icon associated with this submenu's item in its parent menu.

Parameters
icon Drawable: The new icon (as a Drawable) to be displayed.
Returns
SubMenu This SubMenu so additional setters can be called.

See also:

setIcon

Added in API level 1
SubMenu setIcon (int iconRes)

Change the icon associated with this submenu's item in its parent menu.

Parameters
iconRes int: The new icon (as a resource ID) to be displayed.
Returns
SubMenu This SubMenu so additional setters can be called.

See also:

This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a one-minute survey?
Help us improve Android tools and documentation.