private void drawViewImage(View view) {
        if (view.getWidth() == 0 || view.getHeight() == 0) return;
        dialog.getDialogView().setVisibility(GONE);
        setContentViewVisibility(true);
        if (view.getWidth() + view.getHeight() == 0) {
            view.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED), View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));
            view.layout(0, 0, view.getMeasuredWidth(), view.getMeasuredHeight());
        }
        int viewWidth = view.getWidth();
        int viewHeight = view.getHeight();
        Bitmap bitmap = Bitmap.createBitmap(viewWidth, viewHeight, Bitmap.Config.ARGB_8888);
        Canvas canvas = new Canvas(bitmap);
        try {
            view.draw(canvas);
        } catch (Exception e) {
            if (DialogX.DEBUGMODE) e.printStackTrace();
            if (useHardwareRenderingMode) {
                useHardwareRenderingMode = false;
                requestLayoutType();
                drawViewImage(view);
            }
        }
        setImageBitmap(Bitmap.createBitmap(bitmap, 0, 0, view.getWidth(), view.getHeight()));
        isScreenshotSuccess = true;
        setContentViewVisibility(false);
        dialog.getDialogView().setVisibility(VISIBLE);
        dialog.getDialogView().requestFocus();
    }
@author: Kongzue
@github: https://github.com/kongzue/
@homepage: http://kongzue.com/
@mail: myzcxhh@live.cn
@createTime: 2019/11/17 23:53
DialogX/src/main/java/com/kongzue/dialogx/util/views/ActivityScreenShotImageView.java