belongs to Maven artifact com.android.support:appcompat-v7:28.0.0-alpha1
PopupMenu
public
class
PopupMenu
extends Object
java.lang.Object | |
↳ | android.support.v7.widget.PopupMenu |
Static library support version of the framework's PopupMenu
.
Used to write apps that run on platforms prior to Android 3.0. When running
on Android 3.0 or above, this implementation is still used; it does not try
to switch to the framework's implementation. See the framework SDK
documentation for a class overview.
Summary
Nested classes | |
---|---|
interface |
PopupMenu.OnDismissListener
Callback interface used to notify the application that the menu has closed. |
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)
Constructor to create a new popup menu with an anchor view. |
|
PopupMenu(Context context, View anchor, int gravity)
Constructor to create a new popup menu with an anchor view and alignment gravity. |
|
PopupMenu(Context context, View anchor, int gravity, int popupStyleAttr, int popupStyleRes)
Constructor a create a new popup menu with a specific style. |
Public methods | |
---|---|
void
|
dismiss()
Dismiss the menu popup. |
View.OnTouchListener
|
getDragToOpenListener()
Returns an |
int
|
getGravity()
|
Menu
|
getMenu()
Returns the |
MenuInflater
|
getMenuInflater()
|
void
|
inflate(int menuRes)
Inflate a menu resource into this PopupMenu. |
void
|
setGravity(int gravity)
Sets the gravity used to align the popup window to its anchor view. |
void
|
setOnDismissListener(PopupMenu.OnDismissListener listener)
Sets a listener that will be notified when this menu is dismissed. |
void
|
setOnMenuItemClickListener(PopupMenu.OnMenuItemClickListener listener)
Sets a listener that will be notified when the user selects an item from the menu. |
void
|
show()
Show the menu popup anchored to the view specified during construction. |
Inherited methods | |
---|---|
![]()
java.lang.Object
|