共用方式為


PopupWindow.ShowAtLocation(View, GravityFlags, Int32, Int32) Method

Definition

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

[Android.Runtime.Register("showAtLocation", "(Landroid/view/View;III)V", "GetShowAtLocation_Landroid_view_View_IIIHandler")]
public virtual void ShowAtLocation (Android.Views.View? parent, Android.Views.GravityFlags gravity, int x, int y);
[<Android.Runtime.Register("showAtLocation", "(Landroid/view/View;III)V", "GetShowAtLocation_Landroid_view_View_IIIHandler")>]
abstract member ShowAtLocation : Android.Views.View * Android.Views.GravityFlags * int * int -> unit
override this.ShowAtLocation : Android.Views.View * Android.Views.GravityFlags * int * int -> unit

Parameters

parent
View

a parent view to get the android.view.View#getWindowToken() token from

gravity
GravityFlags

the gravity which controls the placement of the popup window

x
Int32

the popup's x location offset

y
Int32

the popup's y location offset

Attributes

Remarks

Display the content view in a popup window at the specified location. If the popup window cannot fit on screen, it will be clipped. See android.view.WindowManager.LayoutParams for more information on how gravity and the x and y parameters are related. Specifying a gravity of android.view.Gravity#NO_GRAVITY is similar to specifying Gravity.LEFT | Gravity.TOP.

Java documentation for android.widget.PopupWindow.showAtLocation(android.view.View, int, int, int).

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.

Applies to