您的位置:首页 > 移动开发 > Android开发

【android】PopWindow----还没有更完

2015-11-05 10:03 369 查看
PopupWindow(Context
context)
Create a new empty, non focusable popup window of dimension (0,0).
创建一个空的不可调焦的尺寸为(0,0) 的实例
PopupWindow(Context
context,
AttributeSet attrs)
Create a new empty, non focusable popup window of dimension (0,0).
PopupWindow(Context
context,
AttributeSet attrs, int defStyleAttr)
Create a new empty, non focusable popup window of dimension (0,0).
PopupWindow(Context
context,
AttributeSet attrs, int defStyleAttr, int defStyleRes)
Create a new, empty, non focusable popup window of dimension (0,0).
PopupWindow()
Create a new empty, non focusable popup window of dimension (0,0).
PopupWindow(View
contentView)
Create a new non focusable popup window which can display the contentView.
PopupWindow(int width, int height)
Create a new empty, non focusable popup window.
PopupWindow(View
contentView, int width, int height)
Create a new non focusable popup window which can display the contentView.
PopupWindow(View
contentView, int width, int height, boolean focusable)
Create a new popup window which can display the contentView.
void
dismiss()
Dispose of the popup window.
int
getAnimationStyle()
Return the animation style to use the popup appears and disappears
Drawable
getBackground()
Return the drawable used as the popup window's background.
View
getContentView()
Return the view used as the content of the popup window.
float
getElevation()
int
getHeight()
Return this popup's height MeasureSpec
int
getInputMethodMode()
Return the current value in
setInputMethodMode(int).
int
getMaxAvailableHeight(View
anchor)
Returns the maximum height that is available for the popup to be completely shown.
int
getMaxAvailableHeight(View
anchor, int yOffset)
Returns the maximum height that is available for the popup to be completely shown.
返回最大这个pop完全显示的最大高度
int
getSoftInputMode()
Returns the current value in
setSoftInputMode(int).
int
getWidth()
Return this popup's width MeasureSpec
boolean
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).
指出这pop是否弹出于锚(view)之上。(pop y坐标小于锚view的y坐标)或在锚(view)之下(pop y坐标大于锚view的y坐标)
boolean
isClippingEnabled()
Indicates whether clipping of the popup window is enabled.
指定弹出的窗口是否可以剪切。
boolean
isFocusable()
Indicate whether the popup window can grab the focus.
指定弹出的窗口是否可以获取焦点。
boolean
isOutsideTouchable()
Indicates whether the popup window will be informed of touch events outside of its window.
指出是否响应pop窗口之外的touch事件。
boolean
isShowing()
Indicate whether this popup window is showing on screen.
指出pop当前是否正在显示。
boolean
isSplitTouchEnabled()
Indicates whether the popup window supports splitting touches.
boolean
isTouchable()
Indicates whether the popup window receives touch events.
指出当前pop窗口是否接受touch事件。
void
setAnimationStyle(int animationStyle)
Change the animation style resource for this popup.
更改此弹出pop窗口的动画风格。
void
setBackgroundDrawable(Drawable
background)
Specifies the background drawable for this popup window.
为这个pop窗口指定背景。
void
setClippingEnabled(boolean enabled)
Allows the popup window to extend beyond the bounds of the screen.
允许弹窗超出屏幕的范围
void
setContentView(View
contentView)
Change the popup's content.
改变窗口弹出的内容。
void
setElevation(float elevation)
Specifies the elevation for this popup window.
void
setFocusable(boolean focusable)
Changes the focusability of the popup window.
void
setHeight(int height)
Change the popup's height MeasureSpec
If the popup is showing, calling this method will take effect only the next time the popup is shown.
改变pop的高度范围。
如果pop正在显示,调用这个方法会在下一次pop窗口的时候起作用。
void
setIgnoreCheekPress()
Set the flag on popup to ignore cheek press eventt; by default this flag is set to false which means the pop wont ignore cheek press dispatch events.
void
setInputMethodMode(int mode)
Control how the popup operates with an input method: one of
INPUT_METHOD_FROM_FOCUSABLE,
INPUT_METHOD_NEEDED, or
INPUT_METHOD_NOT_NEEDED.
void
setOnDismissListener(PopupWindow.OnDismissListener
onDismissListener)
Sets the listener to be called when the window is dismissed.
void
setOutsideTouchable(boolean touchable)
Controls whether the pop-up will be informed of touch events outside of its window.
void
setSoftInputMode(int mode)
Sets the operating mode for the soft input area.
void
setSplitTouchEnabled(boolean enabled)
Allows the popup window to split touches across other windows that also support split touch.
void
setTouchInterceptor(View.OnTouchListener
l)
Set a callback for all touch events being dispatched to the popup window.
void
setTouchable(boolean touchable)
Changes the touchability of the popup window.
void
setWidth(int width)
Change the popup's width MeasureSpec
If the popup is showing, calling this method will take effect only the next time the popup is shown.
void
setWindowLayoutMode(int widthSpec, int heightSpec)
Change the width and height measure specs that are given to the window manager by the popup.
void
showAsDropDown(View
anchor, int xoff, int yoff, int gravity)
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.
void
showAsDropDown(View
anchor, int xoff, int yoff)
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.
void
showAsDropDown(View
anchor)
Display the content view in a popup window anchored to the bottom-left corner of the anchor view.
void
showAtLocation(View
parent, int gravity, int x, int y)
Display the content view in a popup window at the specified location.
void
update(View
anchor, int width, int height)
Updates the position and the dimension of the popup window.
void
update(int x, int y, int width, int height)
Updates the position and the dimension of the popup window.
void
update(View
anchor, int xoff, int yoff, int width, int height)
Updates the position and the dimension of the popup window.
void
update()
Updates the state of the popup window, if it is currently being displayed, from the currently set state.
void
update(int x, int y, int width, int height,
boolean force)
Updates the position and the dimension of the popup window.
void
update(int width, int height)
Updates the dimension of the popup window.

public void setFocusable
(boolean focusable)

Added in
API level 1

Changes the focusability of the popup window. When focusable, the window will grab the focus from the current focused widget if the popup contains a focusable
View
. By default a popup window is not focusable.

If the popup is showing, calling this method will take effect only the next time the popup is shown or through a manual call to one of the
update()
methods.

改变popWindow是否可以获取焦点的状态。当可以获取焦点的时候,如果popWindow包含可以获取焦点的View,一旦pop弹出就会拿走当前正处于聚焦状态下的视图的焦点,默认情况下pop是不可获取焦点的。

如果pop正处于显示状态,调用这个方法将会在下次弹出的时候起作用,也可以通过调用 updata() 方法使这个方法马上起作用。

Parameters
focusabletrue if the popup should grab focus, false otherwise.
See Also

isFocusable()

isShowing()

update()
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: