共用方式為


PopupWindow.SetWindowLayoutMode(Int32, Int32) Method

Definition

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

[Android.Runtime.Register("setWindowLayoutMode", "(II)V", "GetSetWindowLayoutMode_IIHandler")]
public virtual void SetWindowLayoutMode (int widthSpec, int heightSpec);
[<Android.Runtime.Register("setWindowLayoutMode", "(II)V", "GetSetWindowLayoutMode_IIHandler")>]
abstract member SetWindowLayoutMode : int * int -> unit
override this.SetWindowLayoutMode : int * int -> unit

Parameters

widthSpec
Int32

an explicit width measure spec mode, either ViewGroup.LayoutParams#WRAP_CONTENT, ViewGroup.LayoutParams#MATCH_PARENT, or 0 to use the absolute width.

heightSpec
Int32

an explicit height measure spec mode, either ViewGroup.LayoutParams#WRAP_CONTENT, ViewGroup.LayoutParams#MATCH_PARENT, or 0 to use the absolute height.

Attributes

Remarks

Change the width and height measure specs that are given to the window manager by the popup. By default these are 0, meaning that the current width or height is requested as an explicit size from the window manager. You can supply ViewGroup.LayoutParams#WRAP_CONTENT or ViewGroup.LayoutParams#MATCH_PARENT to have that measure spec supplied instead, replacing the absolute width and height that has been set in the popup.

If the popup is showing, calling this method will take effect only the next time the popup is shown.

This member is deprecated. Use #setWidth(int) and #setHeight(int).

Java documentation for android.widget.PopupWindow.setWindowLayoutMode(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