Compartilhar via


PopupWindow Class

Definition

This class represents a popup window that can be used to display an arbitrary view.

[Android.Runtime.Register("android/widget/PopupWindow", DoNotGenerateAcw=true)]
public class PopupWindow : Java.Lang.Object
[<Android.Runtime.Register("android/widget/PopupWindow", DoNotGenerateAcw=true)>]
type PopupWindow = class
    inherit Object
Inheritance
PopupWindow
Attributes

Remarks

This class represents a popup window that can be used to display an arbitrary view. The popup window is a floating container that appears on top of the current activity.

"Animation"><h3>Animation</h3>

On all versions of Android, popup window enter and exit animations may be specified by calling #setAnimationStyle(int) and passing the resource ID for an animation style that defines windowEnterAnimation and windowExitAnimation. For example, passing android.R.style#Animation_Dialog will give a scale and alpha animation. </br> A window animation style may also be specified in the popup window's style XML via the android.R.styleable#PopupWindow_popupAnimationStyle popupAnimationStyle attribute.

Starting with API 23, more complex popup window enter and exit transitions may be specified by calling either #setEnterTransition(Transition) or #setExitTransition(Transition) and passing a Transition. </br> Popup enter and exit transitions may also be specified in the popup window's style XML via the android.R.styleable#PopupWindow_popupEnterTransition popupEnterTransition and android.R.styleable#PopupWindow_popupExitTransition popupExitTransition attributes, respectively.

Java documentation for android.widget.PopupWindow.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Constructors

PopupWindow()

Create a new empty, non focusable popup window of dimension (0,0).

PopupWindow(Context, IAttributeSet, Int32, Int32)

Create a new, empty, non focusable popup window of dimension (0,0).

PopupWindow(Context, IAttributeSet, Int32)

Create a new empty, non focusable popup window of dimension (0,0).

PopupWindow(Context, IAttributeSet)

Create a new empty, non focusable popup window of dimension (0,0).

PopupWindow(Context)

Create a new empty, non focusable popup window of dimension (0,0).

PopupWindow(Int32, Int32)

Create a new empty, non focusable popup window.

PopupWindow(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

PopupWindow(View, Int32, Int32, Boolean)

Create a new popup window which can display the contentView.

PopupWindow(View, Int32, Int32)

Create a new non focusable popup window which can display the contentView.

PopupWindow(View)

Create a new non focusable popup window which can display the contentView.

Properties

AnimationStyle

Return the animation style to use the popup appears and disappears -or- Change the animation style resource for this popup.

AttachedInDecor

Indicates whether the popup window will be attached in the decor frame of its parent window. -or- This will attach the popup window to the decor frame of the parent window to avoid overlaping with screen decorations like the navigation bar.

Background

Return the drawable used as the popup window's background.

Class

Returns the runtime class of this Object.

(Inherited from Object)
ClippingEnabled

Indicates whether clipping of the popup window is enabled. -or- Allows the popup window to extend beyond the bounds of the screen.

ContentView

Return the view used as the content of the popup window. -or- Change the popup's content.

Elevation

Specifies the elevation for this popup window.

EnterTransition

Returns the enter transition to be used when the popup window is shown.

EpicenterBounds

Returns bounds which are used as a center of the enter and exit transitions. -or- Sets the bounds used as the epicenter of the enter and exit transitions.

ExitTransition

Returns the exit transition to be used when the popup window is dismissed.

Focusable

Indicate whether the popup window can grab the focus. -or- Changes the focusability of the popup window.

Handle

The handle to the underlying Android instance.

(Inherited from Object)
Height

Returns the popup's requested height. -or- Sets the popup's requested height.

InputMethodMode

Return the current value in #setInputMethodMode(int). -or- Control how the popup operates with an input method: one of #INPUT_METHOD_FROM_FOCUSABLE, #INPUT_METHOD_NEEDED, or #INPUT_METHOD_NOT_NEEDED.

IsAboveAnchor

Indicates whether the popup is showing above (the y coordinate of the popup's bottom is less than the y coordinate of the anchor) or below the anchor view (the y coordinate of the popup is greater than y coordinate of the anchor's bottom).

IsClippedToScreen

Indicates whether this popup will be clipped to the screen and not to the containing window<p/> -or- Clip this popup window to the screen, but not to the containing window.

IsLaidOutInScreen

Indicates whether the popup window will be forced into using absolute screen coordinates for positioning. -or- Allows the popup window to force the flag WindowManager.LayoutParams#FLAG_LAYOUT_IN_SCREEN, overriding default behavior.

IsShowing

Indicate whether this popup window is showing on screen.

JniIdentityHashCode (Inherited from Object)
JniPeerMembers
OutsideTouchable

Indicates whether the popup window will be informed of touch events outside of its window. -or- Controls whether the pop-up will be informed of touch events outside of its window.

OverlapAnchor

Returns whether the popup window should overlap its anchor view when displayed as a drop-down. -or- Sets whether the popup window should overlap its anchor view when displayed as a drop-down.

PeerReference (Inherited from Object)
SoftInputMode

Returns the current value in #setSoftInputMode(int). -or- Sets the operating mode for the soft input area.

SplitTouchEnabled

Indicates whether the popup window supports splitting touches. -or- Allows the popup window to split touches across other windows that also support split touch.

ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Touchable

Indicates whether the popup window receives touch events. -or- Changes the touchability of the popup window.

TouchModal

Indicates whether outside touches will be sent to this window or other windows behind it<p/> -or- Set whether this window is touch modal or if outside touches will be sent to other windows behind it.

Width

Returns the popup's requested width. -or- Sets the popup's requested width.

WindowLayoutType

Returns the layout type for this window. -or- Set the layout type for this window.

Methods

Clone()

Creates and returns a copy of this object.

(Inherited from Object)
Dismiss()

Disposes of the popup window.

Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
GetMaxAvailableHeight(View, Int32, Boolean)

Returns the maximum height that is available for the popup to be completely shown, optionally ignoring any bottom decorations such as the input method.

GetMaxAvailableHeight(View, Int32)

Returns the maximum height that is available for the popup to be completely shown.

GetMaxAvailableHeight(View)

Returns the maximum height that is available for the popup to be completely shown.

JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
SetBackgroundDrawable(Drawable)

Specifies the background drawable for this popup window.

SetEnterTransition(Transition)

Sets the enter transition to be used when the popup window is shown.

SetExitTransition(Transition)

Sets the exit transition to be used when the popup window is dismissed.

SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
SetIgnoreCheekPress()

Set the flag on popup to ignore cheek press events; by default this flag is set to false which means the popup will not ignore cheek press dispatch events.

SetOnDismissListener(PopupWindow+IOnDismissListener)

Sets the listener to be called when the window is dismissed.

SetTouchInterceptor(View+IOnTouchListener)

Set a callback for all touch events being dispatched to the popup window.

SetWindowLayoutMode(Int32, Int32)

Change the width and height measure specs that are given to the window manager by the popup.

ShowAsDropDown(View, Int32, Int32, GravityFlags)

Displays the content view in a popup window anchored to the corner of another view.

ShowAsDropDown(View, Int32, Int32)

Display the content view in a popup window anchored to the bottom-left corner of the anchor view offset by the specified x and y coordinates.

ShowAsDropDown(View)

Display the content view in a popup window anchored to the bottom-left corner of the anchor view.

ShowAtLocation(View, GravityFlags, Int32, Int32)

Display the content view in a popup window at the specified location.

ToArray<T>() (Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime() (Inherited from Object)
Update()

Updates the state of the popup window, if it is currently being displayed, from the currently set state.

Update(Int32, Int32, Int32, Int32, Boolean)

Updates the position and the dimension of the popup window.

Update(Int32, Int32, Int32, Int32)

Updates the position and the dimension of the popup window.

Update(Int32, Int32)

Updates the dimension of the popup window.

Update(View, Int32, Int32, Int32, Int32)

Updates the position and the dimension of the popup window.

Update(View, Int32, Int32)

Updates the position and the dimension of the popup window.

Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)

Events

DismissEvent
TouchIntercepted

Explicit Interface Implementations

IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to