开发者

Using MediaPlayer on a windowIsFloating activity gives shadow overlaying the video [duplicate]

开发者 https://www.devze.com 2023-02-12 02:54 出处:网络
This question already has answers here: How do I create a transparent Activity on Android? (25 answers)
This question already has answers here: How do I create a transparent Activity on Android? (25 answers) Closed 2 years ago.

When I use MediaPlayer to play video in an Activity that themed as a dialog or w开发者_StackOverflow社区ith 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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消