android - how to dismiss a popupwindow when click button? -
what want do
want write button when click show popupwindow,and when click outside or click button again popupwindow dismiss.what do
i use code this
mpopupwindow=new popupwindow(); mpopupwindow.settouchable(true); mpopupwindow.setoutsidetouchable(true); mpopupwindow.setwidth(windowmanager.layoutparams.wrap_content); mpopupwindow.setheight(windowmanager.layoutparams.wrap_content); brush.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { mpopupwindow.setcontentview(brushview); mpopupwindow.showasdropdown(v); } });
what problem
when click button again show attempted finish input event input event receiver has been disposed.
it think because tirgger outside , clicklistener
please try below answer:
mpopupwindow.setbackgrounddrawable(new bitmapdrawable()); mpopupwindow.setoutsidetouchable(true);
Comments
Post a Comment