When Android popup is set to not clickable, pressing Keyback also doesn't respond?

Source: Internet
Author: User

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?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.