解雇弹出窗口时,后退按钮是pressed [英] Dismiss Pop up window when back button is pressed
问题描述
我要关闭该弹出窗口时后退按钮是pressed。我试着用这个code: popwindow.setBackgroundDrawable(新BitmapDrawable());
和它的作品。但是,在我的应用程序,弹出应该保持,甚至触摸弹出窗口外后。它应该被解雇,只有当后退按钮是pressed。所以,我想这样的: popwindow.setFocusable(假);
现在它的时候弹出感动外不是不屑一顾。但它不是驳回背部preSS了。我不想在此改变`onBack pressed()。是否有任何其他的方式,通过它我可以做到这一点。在此先感谢..
I want to dismiss the pop up window when back button is pressed. I tried with this code:
popwindow.setBackgroundDrawable(new BitmapDrawable());
and it works. But in my app, pop should remain, even after touching outside of the pop up window. It should be dismissed only when back button is pressed. So I tried this: popwindow.setFocusable(false);
Now its not dismissing when touched outside the pop up. But its not dismissing on back press too. I do not want to overide `onBackPressed(). Is there any other way, through which i can achieve this. Thanks in advance..
推荐答案
要停用弹出解雇点击当外界popwindow的
设置
popwindow.setCanceledOnTouchOutside(false);
和作为驳回的后退按钮
设置
popwindow.setCancelable(true);
这篇关于解雇弹出窗口时,后退按钮是pressed的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!