Recently I am doing a project is need to pop up the message box, I am using the Popupwindow, I previously set the have this:
M_pop_gamematchwaittip.setbackgrounddrawable (New paintdrawable ());
M_pop_gamematchwaittip.setoutsidetouchable (TRUE);
Is the support box outside the click to get focus off, but the user is not effective, now to the information prompt box can not click the screen off, to press the Keyback key off, after their own research, the following methods can be implemented to solve the problem:
is in this popupwindow.xml configuration file with an unrelated view or no click on the required view can be, I set the following:
This.m_txt_Match_Name.setFocusableInTouchMode (TRUE);
This.m_txt_Match_Name.setOnKeyListener (New Onkeylistener () {
@Override
public boolean OnKey (View v, int keycode, keyevent event) {
TODO auto-generated Method Stub
if (keycode = = Keyevent.keycode_back)
{
if (m_pop_gamematchwaittip! = null)
{
M_pop_gamematchwaittip.dismiss ();
}
return true;
}
return false;
}
});
This allows you to close the Popupwindow by listening to the view.
Hope that they can help other people who need this problem, there are problems can be exchanged together.
When Android popup is set to not clickable, pressing Keyback also doesn't respond?