Android Chinese Api--popupwindow

Source: Internet
Author: User

The upper half of the text for my translation API documents, the lower part of the transfer from friends to share information.

API documentation

Inheritance Tree :
Java.lang.Object
? Android.widget.PopupWindow

    • Overview:
      Popupwindow, as the name implies, is used to pop up an interface before the current activity, which can be used to display any type of view.

    • Public Constructors :

popupwindow  () popupwindow  (context  Context) popupwindow  (context  Context, AttributeSet attrs) popupwindow  (context  Context, attributeset attrs, int defstyle) popupwindow  (context  Context, attributeset attrs, int defstyleattr, int defstyleres)// Several of these construction methods create a popup window with an empty, non-focused, long-width size of 0 . (less used)  
intint//创建一个没有获取焦点、长为width、宽为height,内容为contentView的popup window.intintboolean//类似上面那个,但第四个参数可以控制是否获取焦点//(这2种使用较多)!!!!
    • Public Methods :
voidDismiss ()//Make popup window disappearintGetanimationstyle ()//Returns the type of animation for which the popup window appears or disappears, the return value is integer typeDrawable Getbackground ()//Returns the background of the popup window with a return value of drawable typevoidSetcontentview (View Contentview)//Set the content displayed by the popup windowView Getcontentview ()//Returns the contents of the popup window and returns a value of a viewintGetHeight ()//Returns the height value of the popup window with a return value of type intvoidSetfocusable (Boolean focusable)//sets whether the popup window receives focusvoidSetinputmethodmode (intMode/ * Set the IME mode with the parameters of these three: input_method_from_focusable (depending on whether you can get the focus), input_method_needed (Allow Input method), or Input_method_not_ NEEDED (Input method is not allowed). This aspect may be involved when the popup window contains EditText, possibly because the input method appears behind the popup window, causing problems that cannot be entered, and can modify the focus and here. */intGetinputmethodmode ()//Returns the current popup window's setting mode for IMEintGetmaxavailableheight (View anchor)//Returns the maximum height that can make the current popup window display fullintGetmaxavailableheight (View anchor,intYoffset)//Ibid .voidSetsoftinputmode (intMode//Set operation mode of input methodintGetsoftinputmode ()//Get operation mode of input methodintGetWidth () Return This popup ' s width measurespecvoidSetHeight (intHeight) Change the popup ' s height measurespecboolean isaboveanchor ()//Determine if the popup window is outside the layout of the parent viewBoolean isfocusable ()//Determines whether the current popup window has the focusBoolean isoutsidetouchable ()//Determine if the current PW's external touch is respondingBoolean isshowing ()//Determines whether the current popup window is in the display stateBoolean issplittouchenabled ()//Determine if the current PW supports multi-point touchBoolean istouchable ()//Determine if the current PW accepts touch eventsvoidSetanimationstyle (intAnimationstyle)//Set popup window's animation style, what style to go to animationvoidSetbackgrounddrawable (drawable background)//Set PW backgroundvoidSetclippingenabled (Boolean enabled)/ * Allow pop-up windows to go beyond the screen range. By default, the window is clipped to the screen boundary. Set to False to allow Windows to pinpoint. That is, if the Popupwindow display area is insufficient or the cascade will cause the drawing position to be calculated inaccurately, it needs to be manually set to False */Boolean isclippingenabled () indicates whether clipping of the popup window is enabled.voidSetignorecheekpress ()/ * I haven't seen this before, and it's kinda fun. Sets whether to ignore "cheek touch", the default is false, that is, do not ignore. What is "cheek touch"? Events have a size that is cheekpress when events are larger than the size of a finger, which can often be used when the cheek touches the screen while on the phone * /voidSetondismisslistener (Popupwindow.ondismisslistener Ondismisslistener)callback method when the//popup window disappearsvoidSetoutsidetouchable (Boolean touchable)/* Controls whether the area outside of the popup window is clicked or not, usually in conjunction with Settouchinterceptor */voidSetsplittouchenabled (Boolean enabled)//Whether to allow separate, multi-touch, generally rarely used, not easy to controlvoidSettouchinterceptor (View.ontouchlistener L)/ * Callback method when the popup window is touched * /voidSettouchable (Boolean touchable)//Set whether the popup window can touchvoidSetWidth (intWidth/ * Modify the width of the popup window, and if the popup window is already displayed, it will not be updated immediately. Only the next occurrence or call to the update () method will be updated */voidSetwindowlayoutmode (intWidthspec,intHEIGHTSPEC)//Change the size of popup managed windowvoidShowasdropdown (View anchor)/* (anchor, as the name implies: anchor.) ) is based on the anchor that triggers the popup window, which appears just below the anchor, and the upper left corner of the Pop_view is positive to the lower left corner of the view, and the offset defaults to 0,0*/voidShowasdropdown (View anchor,intXoffintYoff)/ * If there are parameters, it is to offset the lower left corner of the anchor, Xoff positive right, negative left. Yoff, positive downward, negative upward * / voidShowasdropdown (View anchor,intXoffintYoff,intGravity/* Similar to the previous one, this one is less than */voidShowatlocation (View Parent,intGravityintXintY/ * pops up a window at a specific location displays the specified content parent: Pass the ID of your current layout; Gravity:Gravity.BOTTOM (in the lower-left corner of the screen as a reference), the offset will be the datum point when X y for 0,0 is present at the bottom center * /voidUpdate (View anchor,intWidthintHeightvoidUpdateintXintYintWidthintHeightvoidUpdate (View anchor,intXoffintYoff,intWidthintHeight) Updates the position and the dimension of the popup window.voidUpdate ()voidUpdateintXintYintWidthintHeight, Boolean force)voidUpdateintWidthintHeight/* All updates the size and position of the popup window, depending on whether you change it in the parameter or call setwidth and so on, and then update */
Use and analysis of Android Popupwindow

Android Chinese Api--popupwindow

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.