Android 禁用返回键

重写dispatchKeyEvent方法即可

@Override
    public boolean dispatchKeyEvent(KeyEvent event) {
        if (event.getKeyCode() == KeyEvent.KEYCODE_BACK && isTiming) {
            return true;
        }
        return super.dispatchKeyEvent(event);
    }
posted @ 2022-04-02 16:25  指切  阅读(573)  评论(0编辑  收藏  举报