"Android" Popupwindow Usage Summary

Source: Internet
Author: User

Popupwindow A lot of usage online more, I do not do too much explanation, only say the problems that may be encountered, as well as the solution:

1, Popupwindow in the ListView no response

This is mainly because show is written in front of setfocusable.

2, click Popupwindow outside the area, will not automatically dismiss

This is mostly probably not called setbackgrounddrawable and setoutsidetouchable,

Of course, you must write a response to listen to this action, such as the following code


[Java]View Plaincopy
  1. <span style="font-family: ' Microsoft Yahei ';" ><span style="FONT-SIZE:18PX;" > Mpopupwindow.settouchinterceptor (new Ontouchlistener () {
  2. @Override
  3. Public Boolean OnTouch (View V, motionevent event) {
  4. if (event.getaction () = = Motionevent.action_outside) {
  5. Mpopupwindow.dismiss ();
  6. LOG.I ("test", "test");
  7. return true;
  8. }
  9. return false;
  10. }
  11. });</span></span>

3. Put the default arrow to the right

[Java]View Plaincopy
    1. <span style="font-family: ' Microsoft Yahei ';" ><span style="FONT-SIZE:18PX;"  > int width = Getwindowmanager (). Getdefaultdisplay (). GetWidth ();
    2. Mlistview.setindicatorbounds (width-, width-);</span></span>

    • Prev Android third-party app access Platform (2)
    • The use of the next Article dialog

"Android" Popupwindow Usage Summary

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.