加载中...
The Wayback Machine - https://sup1a9wrlpyh5li9ro.vcoronado.top/web/20110424234613/http://developer.android.com:80/reference/android/widget/PopupMenu.html
public class

PopupMenu

extends Object
implements MenuBuilder.Callback
java.lang.Object
   ↳ android.widget.PopupMenu

Class Overview

A PopupMenu displays a Menu in a modal popup window anchored to a View. The popup will appear below the anchor view if there is room, or above it if there is not. If the IME is visible the popup will not overlap it until it is touched. Touching outside of the popup will dismiss it.

Summary

Nested Classes
interface PopupMenu.OnMenuItemClickListener Interface responsible for receiving menu item click events if the items themselves do not have individual item click listeners. 
Public Constructors
PopupMenu(Context context, View anchor)
Construct a new PopupMenu.
Public Methods
void dismiss()
Dismiss the menu popup.
Menu getMenu()
MenuInflater getMenuInflater()
void setOnMenuItemClickListener(PopupMenu.OnMenuItemClickListener listener)
void show()
Show the menu popup anchored to the view specified during construction.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.android.internal.view.menu.MenuBuilder.Callback

Public Constructors

public PopupMenu (Context context, View anchor)

Since: API Level 11

Construct a new PopupMenu.

Parameters
context Context for the PopupMenu.
anchor Anchor view for this popup. The popup will appear below the anchor if there is room, or above it if there is not.

Public Methods

public void dismiss ()

Since: API Level 11

Dismiss the menu popup.

See Also

public Menu getMenu ()

Since: API Level 11

Returns
  • the Menu associated with this popup. Populate the returned Menu with items before calling show().

public MenuInflater getMenuInflater ()

Since: API Level 11

Returns
See Also

public void setOnMenuItemClickListener (PopupMenu.OnMenuItemClickListener listener)

Since: API Level 11

public void show ()

Since: API Level 11

Show the menu popup anchored to the view specified during construction.

See Also