public final class PopupWindowCompat
extends Object
java.lang.Object | |
↳ | android.support.v4.widget.PopupWindowCompat |
Helper用于访问在向后兼容的API级别4之后引入的PopupWindow中的功能。
Public methods |
|
---|---|
static boolean |
getOverlapAnchor(PopupWindow popupWindow) 当显示为下拉菜单时,返回弹出窗口是否应该与其锚点视图重叠。 |
static int |
getWindowLayoutType(PopupWindow popupWindow) 返回此窗口的布局类型。 |
static void |
setOverlapAnchor(PopupWindow popupWindow, boolean overlapAnchor) 显示为下拉菜单时,设置弹出窗口是否应与其锚点视图重叠。 |
static void |
setWindowLayoutType(PopupWindow popupWindow, int layoutType) 为此窗口设置布局类型。 |
static void |
showAsDropDown(PopupWindow popup, View anchor, int xoff, int yoff, int gravity) 在一个弹出窗口中显示内容视图,该窗口通过指定的x和y坐标偏移到锚点视图的左下角。 |
Inherited methods |
|
---|---|
From class java.lang.Object
|
boolean getOverlapAnchor (PopupWindow popupWindow)
当显示为下拉菜单时,返回弹出窗口是否应该与其锚点视图重叠。
Parameters | |
---|---|
popupWindow |
PopupWindow
|
Returns | |
---|---|
boolean |
Whether the popup should overlap its anchor. |
int getWindowLayoutType (PopupWindow popupWindow)
返回此窗口的布局类型。
Parameters | |
---|---|
popupWindow |
PopupWindow
|
Returns | |
---|---|
int |
void setOverlapAnchor (PopupWindow popupWindow, boolean overlapAnchor)
显示为下拉菜单时,设置弹出窗口是否应与其锚点视图重叠。
Parameters | |
---|---|
popupWindow |
PopupWindow
|
overlapAnchor |
boolean : Whether the popup should overlap its anchor. |
void setWindowLayoutType (PopupWindow popupWindow, int layoutType)
为此窗口设置布局类型。 该值将传递至type
因此该值应与任何值type
接受的值相匹配。
Parameters | |
---|---|
popupWindow |
PopupWindow
|
layoutType |
int : Layout type for this window. |
也可以看看:
void showAsDropDown (PopupWindow popup, View anchor, int xoff, int yoff, int gravity)
在一个弹出窗口中显示内容视图,该窗口通过指定的x和y坐标偏移到锚点视图的左下角。 如果屏幕上没有足够的空间来显示完整的弹出窗口,则此方法尝试查找要滚动的父滚动视图。 如果没有父滚动视图可以滚动,则弹出框的左下角固定在锚视图的左上角。
如果视图稍后滚动以将 anchor
移动到其他位置,则弹出窗口将相应地移动。
Parameters | |
---|---|
popup |
PopupWindow : the PopupWindow to show |
anchor |
View : the view on which to pin the popup window |
xoff |
int : A horizontal offset from the anchor in pixels |
yoff |
int : A vertical offset from the anchor in pixels |
gravity |
int : Alignment of the popup relative to the anchor |