Android--Popupwindow's hidden

Source: Internet
Author: User

Popupwindow's Hidden
Final Popupwindow window = Mpagestatwin; if (null ! = window && window.isshowing ()) {    Win.dismiss ();}
display and position setting of Popupwindow
Window.showatlocation (Parent, Gravity.right | Gravity.bottom, 10,10);

The first parameter specifies the Popupwindow anchor view, which is the view on which to attach.
The second parameter specifies that the starting point is the lower-right corner of the parent, and the third parameter is set to the origin in the lower-right corner of parent, and 10 pixels to the left and the upper.

// displays Popupwindow as a drop-down window for anchor. The Window.showasdropdown (anchor) is displayed in the lower left corner of the anchor  . // The Xoff,yoff is offset based on the lower left corner of the anchor. Window.showasdropdown (anchor, Xoff, Yoff);

If there is not enough space to display the Popupwindow, then the lower left corner of the Popupwindow will be displayed in the upper left corner of anchor.

create Popouwindow and related parameter settings
//Create a Popupwindow that contains a custom viewPrivatePopupwindow Makepopupwindow (Context cx) {Popupwindow window; Window=NewPopupwindow (CX); TextView Contentview=NewTextView (CX);    Contentview.setgravity (Gravity.center); FinalResources res =cx.getresources (); //Contentview.setbackgroundcolor (R.color.page_window_bgcolor); //window.setbackgrounddrawable (New//colordrawable (Res.getcolor (R.color.page_window_bgcolor)));Contentview.setlayoutparams (Newlayoutparams (layoutparams.wrap_content, layoutparams.wrap_content)); //Animate when setting Popupwindow display and hideWindow.setanimationstyle (R.style.animationfade); //set the size of the Popupwindow (width and height)window.setwidth (Res.getdimensionpixelsize (r.dimen.page_window_width));    Window.setheight (Res.getdimensionpixelsize (r.dimen.page_window_height)); //set the contents of the Popupwindow viewWindow.setcontentview (Contentview); //sets whether the Popupwindow external area can be touchedWindow.setoutsidetouchable (true); returnwindow;}
Popupwindow display and hidden animation settings
<!--Popupwindow window fade animation -<stylename= "Animationfade">    <Itemname= "Android:windowenteranimation">@anim/fade_in</Item>    <Itemname= "Android:windowexitanimation">@anim/fade_out</Item></style>
Window.setanimationstyle (R.style.animationfade);
Focus settings for Popupwindow
Window.setfocusable (true// set Popupwindow to get Focus window.settouchable (true//  set Popupwindow to touch window.setoutsidetouchable (true// set non-Popupwindow area to touch
Display and display location settings for Popupwindow
Window.showatlocation (); Window.showasdropdown ();
I'm the dividing line of the king of the land Tiger.

Reference: http://orgcent.com/android-popupwindow-usage/

Android--Popupwindow's hidden

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.