2

When I use MediaPlayer to play video in an Activity that themed as a dialog or with the windowIsFloating property I get a shadow overlaying the video (the dialog background shadow). Why? And how do I get rid of it? I guess it has something to do with the SufaceViews nature of having a z-order behind the window and punching holes in front of it.

The reason why i use the windowIsFloating property is that i need to have the previous activity paused to resume it as fast as possible. I know it can be closed by the OS then as well. But that's OK since it seams that most of the time I don't have to reinitialize the activity.

Or are there any other way to keep my previous activity in a paused state(like when using dialog) while starting my second activity?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Jalvemo
  • 90
  • 1
  • 6

1 Answers1

0

The marked answer doesn't solve the issue if you actually want the background of the activity to be dimmed.

I found that setting either of the following style properties set the video to be dimmed:

<item name="android:windowIsFloating">true</item>
<item name="android:backgroundDimEnabled">true</item>

The solution is to set the VideoView on top:

mVideoView.setZOrderOnTop(true);

Thanks to spatialist for the solution.

Community
  • 1
  • 1
Leon
  • 3,614
  • 1
  • 33
  • 46