PopupWindow
java.lang.Object | |
↳ | android.widget.PopupWindow //widget |
Class Overview//概述 A popup window that can be used to display an arbitrary view. The popup windows is a floating container that appears on top of the current activity.//一个泡泡窗,可以展示任意的视图。它是一个悬浮的容器,出现在当前Acitvity的上面。 public static interface //有一个回调接口
PopupWindow.OnDismissListener
android.widget.PopupWindow.OnDismissListener Class OverviewListener that is called when this popup window is dismissed. //当泡泡关闭的时候调用这个回调方法
void android.widget. PopupWindow.setFocusable(boolean focusable)
public void setFocusable (boolean focusable) Since: 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 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
public void setOutsideTouchable (boolean touchable) Since: API Level 3
Controls whether the pop-up will be informed of touch events outside of its window. This only makes sense for pop-ups that are touchable but not focusable, which means touches outside of the window will be delivered to the window behind. The default is false. // 控制这个泡泡窗在窗口外的触摸事件会不会通知到,这仅会让这个泡泡窗可以被触摸但是还是没有焦点,这将一意味着触摸到了窗口外面将会转交到底下的窗口。默认是false。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 public void showAsDropDown (View anchor, int xoff, int yoff) Since: API Level 1
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. If there is not enough room on screen to show the popup in its entirety, this method tries to find a parent scroll view to scroll. If no parent scroll view can be scrolled, the bottom-left corner of the popup is pinned at the top left corner of the anchor view. //以参照物的左下为标准,偏移xyIf the view later scrolls to move
Parameters
See Also
public void showAsDropDown (View anchor) Since: API Level 1
Display the content view in a popup window anchored to the bottom-left corner of the anchor view. If there is not enough room on screen to show the popup in its entirety, this method tries to find a parent scroll view to scroll. If no parent scroll view can be scrolled, the bottom-left corner of the popup is pinned at the top left corner of the anchor view. //以参照物的左下为标准,不便宜
Parameters
See Also
public void showAtLocation (View parent, int gravity, int x, int y)// 父视图,Gravity,坐标 Since: API Level 1
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
Parameters
|