Android - Close popUpWindow when clicked outside of the view -


i have small problem popup window functionality.i close when user clicks outside of window.i have read lots of atricle on stackoverflow, not single articles helped me. have tried is, have tried popupwindow.setbackgrounddrawable(null); not worked me.

 layoutinflater inflater = (layoutinflater) this.getsystemservice(context.layout_inflater_service);     view layout = inflater.inflate(r.layout.popupmenu_layout, (viewgroup) findviewbyid(r.id.popuplinearlayout));     pw = new popupwindow(layout, 300, 300, true);     pw.showatlocation(layout, gravity.center, 0, 0);     pw.setbackgrounddrawable(null);     pw.setoutsidetouchable(true);     //todo remove popup window when outside touched...     

if know article may me appreciate it.it posible features not working in emulator ? have emulator right now.(android 4.4.2)

and if marcin's constructor deprecated, use

pw.setbackgrounddrawable(new bitmapdrawable(getresources(),"")); 

Comments

Popular posts from this blog

c# - HttpResponseMessage System.InvalidOperationException -

sql - Postgresql error: "failed to find conversion function from unknown to text" -