AlertDialog

alterDilog默认组织键盘弹出的:

public void showPlotDetailDialogs() {
        AlertDialog mDialog = new AlertDialog.Builder(this).create();
        mDialog.show();
//        mDialog.getWindow().
        mDialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);    //键盘
        hide(mDialog);
        mDialog.setCancelable(false);
        mDialog.getWindow().setContentView(R.layout.dialog_layer_h_five);
        WindowManager windowManager = getWindowManager();
        Display defaultDisplay = windowManager.getDefaultDisplay();
        WindowManager.LayoutParams params = mDialog.getWindow().getAttributes();
        params.width = (int) (defaultDisplay.getWidth() * 0.85);
        params.height = (int) (defaultDisplay.getHeight() * 0.85);
        mDialog.getWindow().setAttributes(params);
        mDialog.getWindow().setBackgroundDrawableResource(android.R.color.transparent);
        BridgeWebView webViews = mDialog.findViewById(R.id.h5Web);
        ProgressBar progressBar = mDialog.findViewById(R.id.progress);
        WebSettings webSettings = webViews.getSettings();
        webSettings.setJavaScriptEnabled(true);
        webViews.setWebChromeClient(new WebChromeClient() {
            @Override
            public void onProgressChanged(WebView view, int newProgress) {
                if (newProgress == 100) {
                    progressBar.setProgress(newProgress);
                    progressBar.setVisibility(View.GONE);
                } else {
                    progressBar.setVisibility(View.VISIBLE);
                    progressBar.setProgress(newProgress);
                }
            }
        });
        webViews.registerHandler("certificationSuccess", new BridgeHandler() {
            @Override
            public void handler(String data, CallBackFunction function) {
                Log.e("123456SSS", "data" + data);
                FileUtils.writeToExternalStoragePublic("PHONE", data);
                SharedUtil.putString(SplashActivity.this, "PHONE", "userInfo", data);
                mDialog.dismiss();     //弹窗消失,然后把电话号码存到文件里。
                Application.getInstance().cachedThreadpool.execute(startSystemHal);
                GSMSignal.Instance().start(getApplicationContext());
                startMainActivity();
                addCameraReceiver();

            }
        });

        webViews.loadUrl("https://rtkapp.my.qxwz.com/embed3rd/login.html?sn=" + deviceId + "&" + "dsk=" + QxGlobal.getDSS());
//        webViews.loadUrl("https://hd.qxwz.com/callbridge");
    }

得加上这行: mDialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM); //键盘
取消这个阻止键盘flag的出现

你可能感兴趣的:(android)