Please note that the contents of this offline web site may be out of date. To access the most recent documentation visit the online version .
Note that links that point to online resources are green in color and will open in a new window.
We would love it if you could give us feedback about this material by filling this form (You have to be online to fill it)
Android APIs
public interface

SubMenu

implements Menu
android.view.SubMenu

Class Overview

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

[Expand]
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 ( Drawable icon)
Sets the submenu header's icon to the icon given in icon Drawable .
abstract SubMenu setHeaderIcon (int iconRes)
Sets the submenu header's icon to the icon given in iconRes resource id.
abstract SubMenu setHeaderTitle ( CharSequence title)
Sets the submenu header's title to the title given in title .
abstract SubMenu setHeaderTitle (int titleRes)
Sets the submenu header's title to the title given in titleRes resource identifier.
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.
[Expand]
Inherited Methods
From interface android.view.Menu

Public Methods

public abstract void clearHeader ()

Added in API level 1

Clears the header of the submenu.

public abstract MenuItem getItem ()

Added in API level 1

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

Returns
  • The MenuItem that launches the submenu when invoked.

public abstract SubMenu setHeaderIcon ( Drawable icon)

Added in API level 1

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

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

public abstract SubMenu setHeaderIcon (int iconRes)

Added in API level 1

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

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

public abstract SubMenu setHeaderTitle ( CharSequence title)

Added in API level 1

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

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

public abstract SubMenu setHeaderTitle (int titleRes)

Added in API level 1

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

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

public abstract SubMenu setHeaderView ( View view)

Added in API level 1

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 The View used for the header.
Returns
  • This SubMenu so additional setters can be called.

public abstract SubMenu setIcon ( Drawable icon)

Added in API level 1

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

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

public abstract SubMenu setIcon (int iconRes)

Added in API level 1

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

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