Added in API level 1

ContextMenu


interface ContextMenu : Menu
android.view.ContextMenu

Extension of Menu for context menus providing functionality to modify the header of the context menu.

Context menus do not support item shortcuts and item icons.

To show a context menu on long click, most clients will want to call Activity.registerForContextMenu and override Activity.onCreateContextMenu.

Summary

Nested classes
abstract

Additional information regarding the creation of the context menu.

Inherited constants
Public methods
abstract Unit

Clears the header of the context menu.

abstract ContextMenu!

Sets the context menu header's icon to the icon given in icon Drawable.

abstract ContextMenu!
setHeaderIcon(iconRes: Int)

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

abstract ContextMenu!
setHeaderTitle(titleRes: Int)

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

abstract ContextMenu!

Sets the context menu header's title to the title given in title.

abstract ContextMenu!

Sets the header of the context menu to the View given in view.

Inherited functions

Public methods

clearHeader

Added in API level 1
abstract fun clearHeader(): Unit

Clears the header of the context menu.

setHeaderIcon

Added in API level 1
abstract fun setHeaderIcon(icon: Drawable!): ContextMenu!

Sets the context menu header's icon to the icon given in icon Drawable.

Parameters
icon Drawable!: The Drawable used for the icon.
Return
ContextMenu! This ContextMenu so additional setters can be called.

setHeaderIcon

Added in API level 1
abstract fun setHeaderIcon(iconRes: Int): ContextMenu!

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

Parameters
iconRes Int: The resource identifier used for the icon.
Return
ContextMenu! This ContextMenu so additional setters can be called.

setHeaderTitle

Added in API level 1
abstract fun setHeaderTitle(titleRes: Int): ContextMenu!

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

Parameters
titleRes Int: The string resource identifier used for the title.
Return
ContextMenu! This ContextMenu so additional setters can be called.

setHeaderTitle

Added in API level 1
abstract fun setHeaderTitle(title: CharSequence!): ContextMenu!

Sets the context menu header's title to the title given in title.

Parameters
title CharSequence!: The character sequence used for the title.
Return
ContextMenu! This ContextMenu so additional setters can be called.

setHeaderView

Added in API level 1
abstract fun setHeaderView(view: View!): ContextMenu!

Sets the header of the context menu 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.
Return
ContextMenu! This ContextMenu so additional setters can be called.