Most visited

Recently visited

Added in API level 1

ContextMenu

public interface ContextMenu
implements Menu

android.view.ContextMenu


针对上下文菜单的扩展 Menu提供了修改上下文菜单头部的功能。

上下文菜单不支持项目快捷方式和项目图标。

要长时间显示上下文菜单,大多数客户需要拨打 registerForContextMenu(View)并覆盖 onCreateContextMenu(ContextMenu, View, ContextMenu.ContextMenuInfo)

Developer Guides

有关创建菜单的信息,请阅读 Menus开发人员指南。

Summary

Nested classes

interface ContextMenu.ContextMenuInfo

有关创建上下文菜单的其他信息。

Inherited constants

From interface android.view.Menu

Public methods

abstract void clearHeader()

清除上下文菜单的标题。

abstract ContextMenu setHeaderIcon(int iconRes)

将上下文菜单标题的图标设置为 iconRes资源标识中给出的图标。

abstract ContextMenu setHeaderIcon(Drawable icon)

将上下文菜单标题的图标设置为 图标 Drawable给出的 图标

abstract ContextMenu setHeaderTitle(int titleRes)

将上下文菜单标题的标题设置为 titleRes资源标识中给出的标题。

abstract ContextMenu setHeaderTitle(CharSequence title)

将上下文菜单标题的标题设置为标题中给出的 标题

abstract ContextMenu setHeaderView(View view)

设置上下文菜单中的头 View 鉴于给出。

Inherited methods

From interface android.view.Menu

Public methods

clearHeader

Added in API level 1
void clearHeader ()

清除上下文菜单的标题。

setHeaderIcon

Added in API level 1
ContextMenu setHeaderIcon (int iconRes)

将上下文菜单标题的图标设置为 iconRes资源标识中给出的图标。

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

setHeaderIcon

Added in API level 1
ContextMenu setHeaderIcon (Drawable icon)

将上下文菜单标题的图标设置为 图标 Drawable给出的 图标

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

setHeaderTitle

Added in API level 1
ContextMenu setHeaderTitle (int titleRes)

将上下文菜单标题的标题设置为 titleRes资源标识中给出的标题。

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

setHeaderTitle

Added in API level 1
ContextMenu setHeaderTitle (CharSequence title)

将上下文菜单标题的标题设置为标题中给出的 标题

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

setHeaderView

Added in API level 1
ContextMenu setHeaderView (View view)

将上下文菜单的标题设置为视图中给出的View 这取代了标题标题和图标(以及那些替换它)。

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

Hooray!