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
- <span style="font-family: ' Microsoft Yahei ';" ><span style="FONT-SIZE:18PX;" > Mpopupwindow.settouchinterceptor (new Ontouchlistener () {
- @Override
- Public Boolean OnTouch (View V, motionevent event) {
- if (event.getaction () = = Motionevent.action_outside) {
- Mpopupwindow.dismiss ();
- LOG.I ("test", "test");
- return true;
- }
- return false;
- }
- });</span></span>
3. Put the default arrow to the right
[Java]View Plaincopy
- <span style="font-family: ' Microsoft Yahei ';" ><span style="FONT-SIZE:18PX;" > int width = Getwindowmanager (). Getdefaultdisplay (). GetWidth ();
- 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