Dialog穿透事件处理


    @Override
    public void show() {
        super.show();
//        /**
//         * 设置宽度全屏,要设置在show的后面
//         */
        WindowManager.LayoutParams params = getWindow().getAttributes();
        params.width = WindowManager.LayoutParams.MATCH_PARENT;
        params.height = WindowManager.LayoutParams.WRAP_CONTENT;
        params.gravity = Gravity.BOTTOM;
        // 拥有穿透效果 dialog布局之外可以相应事件传递
        params.flags = WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL;
        getWindow().setBackgroundDrawableResource(android.R.color.transparent);

        getWindow().setDimAmount(0f);
        getWindow().setAttributes(params);
    }

你可能感兴趣的:(Dialog穿透事件处理)