Romanski Romanski - 3 months ago 36
Android Question

Android: Set windowIsTranslucent from activty

I'm developing a library where I have to set the window background programmatically and I can't use custom style xmls. The idea is that the user who implements the library can set any theme he want - I just need to make the background transparent. So all the styles for the widgets will stay the same.

I tired some window flags like WindowManager.LayoutParams.FLAG_DIM_BEHIND and WindowManager.LayoutParams.FLAG_BLUR_BEHIND, but none of them was working.

Every solution that I've found is based on the style xml file.

Is there a way to set windowIsTranslucent directly from the code?

Thanks in advance, Roman


No, this is not possible.

It is only possible to set windowIsTranslucent in your theme.

Suggestion; Create your own theme that others can override.