无法使我的覆盖屏幕全屏。请帮忙!这是我尝试过的,没有任何帮助我解决堆栈溢出问题。这是我在前台服务中制作全屏视图的代码。
private fun addFloatingWidgetView(inflater: LayoutInflater, displayMetrics: DisplayMetrics) {
// mFloatingWidgetView = inflater.inflate(R.layout.dialog_layout, null, false)
// (mFloatingWidgetView!!.findViewById<View>(R.id.root_container) as ViewGroup).layoutTransition
// .enableTransitionType(LayoutTransition.CHANGING)
val params = WindowManager.LayoutParams(
WindowManager.LayoutParams.MATCH_PARENT,
WindowManager.LayoutParams.MATCH_PARENT,
WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY,
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN,
PixelFormat.TRANSLUCENT
)
params.gravity = Gravity.CENTER
params.windowAnimations = android.R.style.Animation_Translucent
mWindowManager!!.addView(mFloatingWidgetView, params)
}