I want to clicked back button to dismiss PopupWindow.But I can also click outside to do another thing,the PopupWindow don't miss.
I try popupWindow.setFocusable(true);
,but the PopupWindow will dismiss when I click outside.
I try to custom view.
public class OtherBrifeIntroView extends LinearLayout
{
@Override
public boolean dispatchKeyEvent(KeyEvent event)
{
if (event.getKeyCode() == KeyEvent.KEYCODE_BACK)
{
Toast.makeText(mContext, "test", Toast.LENGTH_SHORT).show();
return true;
}
return super.dispatchKeyEvent(event);
}
}
but it doesn't work.Can you help me?