Fragmentation icon indicating copy to clipboard operation
Fragmentation copied to clipboard

在使用popwindow时碰到的问题

Open Hell-And opened this issue 6 years ago • 2 comments

在使用popwindow时,会设置背景变暗, //如果设置的值在0 - 1的范围内,则用设置的值,否则用默认值 final float alpha = (mBackgroundDrakValue > 0 && mBackgroundDrakValue < 1) ? mBackgroundDrakValue : DEFAULT_ALPHA; mWindow = activity.getWindow(); WindowManager.LayoutParams params = mWindow.getAttributes(); params.alpha = alpha; mWindow.setAttributes(params); mWindow.addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); 在pop弹出的时候会看到上一个界面和当前页面重叠,只是一瞬间,但是很清晰,感觉页面穿透了。网上说是因为theme设置了 true。 我去掉这个设置,pop是没有问题了,但是返回又会有黑屏问题,因为android:windowIsTranslucent对于fragmentation又是必须的。

请问有什么方式能协调吗?

Hell-And avatar May 31 '19 08:05 Hell-And

是因为theme中 windowIsTranslucent 设置了 true。

Hell-And avatar May 31 '19 08:05 Hell-And

application的theme添加android:windowBackground @color/white去掉windowIsTranslucent,不过会在启动页出现启动的时候会闪一下白色,这个时候可以在启动页的activity标签下继承application的theme再次加上windowIsTranslucent配置在启动页的activty下的theme,这样就可以解闪屏和pop第一次点击看到桌面的问题

liulilei avatar Sep 27 '19 06:09 liulilei