美文网首页
在Dialog中监听返回键事件

在Dialog中监听返回键事件

作者: 好学人 | 来源:发表于2019-12-05 19:53 被阅读0次

在Dialog中监听返回键事件

dialog.setOnKeyListener(new DialogInterface.OnKeyListener() {
    @Override
    public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
        if (keyCode == KeyEvent.KEYCODE_BACK) {
            // you code here;
            return true;
        }
        return false;
    }
});

相关文章

网友评论

      本文标题:在Dialog中监听返回键事件

      本文链接:https://www.haomeiwen.com/subject/jvejgctx.html