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