It seems like there is no way to solve the glitch, simply windowIsFloating
flag is very buggy with SurfaceView
...
So, following also the answer here How to create a transparent activity WITHOUT windowIsFloating, I ended up by creating a theme that extends Dialog's theme but set windowIsFloating
flag to false
and windowIsTranslucent
to true
.
That way you need manually to create a layout that behave like a Dialog, but you don't have any glitch and your background can be fully transparent :)
Symple example of a theme that will do the trick:
<style name="MyTheme" parent="@android:style/Theme">
<item name="android:windowIsFloating">false</item>
<item name="android:windowIsTranslucent">true</item>
</style>
Then you need to apply margins to your layout, otherwise it will be fullscreen as a normal Activity.