Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android VideoView on a Translucent Activity

I have an app that I'm working where in one activity I'm using a VideoView while setting the theme for that activity translucent (transparent) : android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"

However I'm noticing odd behavior from the videoView - for a split second before the video starts playing (it's auto play) the frame where the videoView is itself transparent and you can see the activity behind it. For reference the activity in question has other elements to it and the video is framed.

Is there anyway to make this black or even a custom image that covers the frame before the video starts?

videoView.setBackgroundColor is buggy and actually changes the foreground color and keeps the frame that color while playing...

thanks for your time!

like image 998
djxstream Avatar asked Dec 26 '22 01:12

djxstream


1 Answers

videoView.setZOrderOnTop(true);

SurfaceView (and VideoView as subclass) is placed behind the window by default. So you should call: videoView.setZOrderOnTop(true) if you want to place it on top (to make it non transparent).

like image 190
anonymous Avatar answered Jan 03 '23 06:01

anonymous