Android English document translation series (4)--popupwindow

Source: Internet
Author: User

Public Classpopupwindowextends object//directly inherits to object
Java.lang.Object
? Android.widget.PopupWindow
Widgets
Class overview//Overview
A Popup window that can is used to the display an arbitrary view. The popup windows is a floating container this appears on top of the current activity.
A bubble window that can display any view. It is a suspended container that appears on top of the current acitvity.

public static interface//has a callback interface Popupwindow.ondismisslistener
Android.widget.PopupWindow.OnDismissListener
Class Overview

Listener that was called when the This popup window was dismissed.
Call this callback method when the bubble is closed

Public constructors//constructors
Popupwindow (Context context)

Create a new empty, Non focusable popup window of Dimension (0,0).
Create an empty bubble window with no focus

Popupwindow (context context, AttributeSet attrs)

Create a new empty, Non focusable popup window of Dimension (0,0).

Popupwindow (context context, AttributeSet attrs, int defstyle)

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.
Create a bubble with no focus to show 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 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 would grab the focus from the current focused widget if the popup contains a focusable View . By default a popup window was not focusable.
Setting the focus of the bubble window, when there is a focus, if the bubble contains a view, it will preempt the focus of the current widget. The default bubble is not focused.

If the popup is showing, calling this method would take effect only the next time the popup is shown or through a manual CA ll to one of the update() methods.
If the bubble is in show, call this method only when the next bubble shows up, or by manually calling the update () method.

public void Setoutsidetouchable (Boolean touchable) Since:api level 3

Controls whether the pop-up would be informed of touch events outside in its window. This is makes sense for pop-ups that is touchable but not focusable, which means touches outside of the window would be Delivered to the window behind. The default is False.
Controls whether the bubble window touch event outside the window will not be notified, this only makes the bubble window can be touched but there is no focus, this will mean that the touch of the window outside will be transferred to the bottom of the window. The default is False.

If the popup is showing, calling this method would take effect only the next time the popup is shown or through a manual CA ll to one of the update() methods.
This method also needs to be refreshed to take effect in time.

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 the class 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 scrolled, the bottom-left corner of the popup is pinned at the top left corner of the Anch or view.
Offset xy with lower left of reference

If The view later scrolls to move anchor to a different location, the popup would be moved correspondingly.

Parameters
Anchor The view on which to pin the popup window
See Also
    • dismiss()
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 the class 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 scrolled, the bottom-left corner of the popup is pinned at the top left corner of the Anch or view.
With reference to the lower left of the standard, not cheap

Parameters
Anchor The view on which to pin the popup window
See Also
    • dismiss()
public void Showatlocation (View parent, int gravity, int x, int y)
Parent view, Gravity, coordinates 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'll be clipped. See for more information on how gravity and the WindowManager.LayoutParams x and y parameters is related. Specifying a gravity of are NO_GRAVITY similar to specifying Gravity.LEFT | Gravity.TOP .

Displays a content view by default in a window. If the bubble window does not fit the screen, it will only show the part. Layoutparams is related to how to center and coordinate parameters. Making a center-less one is like living right on the left.

Parameters
Parent A parent view to get the getWindowToken() token from
Gravity The gravity which controls the placement of the popup window
X The popup ' s X location offset
Y The popup ' s Y location offset

Android English document translation series (4)--popupwindow

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.