解决dispatchKeyEvent监听执行两次

@Override
public boolean dispatchKeyEvent(KeyEvent event) {
if(event.getKeyCode() == KeyEvent.KEYCODE_BACK && event.getAction() != KeyEvent.ACTION_UP) {//不响应按键抬起时的动作,否则会出现两次响应事件
//自己的逻辑
}
return false;
}
————————————————
版权声明:本文为CSDN博主「梦中一夜下江南」的原创文章,遵循CC 4.0 by-sa版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/v2810769/article/details/53781811

未经允许不得转载:A66网 » 解决dispatchKeyEvent监听执行两次

赞 (0)
分享到:更多 ()

评论 1

  1. 匿名I think other website proprietors should take this website as an model, very clean and excellent user genial style and design, let alone the content. You are an expert in this topic!回复