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

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -