android - Why doesn't a PopupWindow whose layout is inflated from XML accept touch events? -
given popupwindow defined this:
public class mywindow extends popupwindow implements view.ontouchlistener { mywindow(view view) { super(view); setheight(view.getmeasuredheight()); setfocusable(true); settouchable(true); settouchinterceptor(this); } public boolean ontouch(view v, motionevent event) { system.out.println("ontouch()"); return true; } } for reason, ontouch() never called.
what doing wrong? how can popupwindow accept touch events?
as discussed in this answer different question, popupwindow needs have background drawable explicitly set, when has been inflated xml , doesn't visually need background set.
i fixed adding line:
setbackgrounddrawable(new shapedrawable()); to constructor.
Comments
Post a Comment