我刚刚发现通过使用从服务制作的自定义视图WindowManager.LayoutParams
没有DecorView
.
这里是下面的代码
WindowManager mWindowManager = (WindowManager)getSystemService(WINDOW_SERVICE);
WindowManager.LayoutParams mParams = new WindowManager.LayoutParams(
getDialogWidth(mWindowManager)
, getDialogHeight(mWindowManager)
, WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY
, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
, PixelFormat.TRANSLUCENT);
mParams.gravity = Gravity.CENTER;
mParams.windowAnimations = android.R.style.Animation_Dialog;
mWindowManager.addView(customView, mParams);
但是Activity
, AlertDialog
,DialogFragment
等等都有一个DecorView
.
为什么由服务制作的自定义视图没有 DecorView?