Setting background colour for VideoView hides the video

拜拜、爱过 提交于 2019-12-23 13:19:12

问题


I am using a VideoView in my app and when I set the background colour with either the layout properties, or in the code itself, the background colour is laid over the top of my video and I cannot see it.


回答1:


VideoView extends SurfaceView, which relies on PorterDuff.Mode.CLEAR to cut a hole in the view hierarchy so that you can see a native rendering surface underneath. If you make it fill itself back in with a solid color, you will not be able to see the video. While the video is playing, you would not be able to see the background, so I assume you want it to be a different color while there is no video. In that case, use the OnCompletionListener of the MediaPlayer to change things... perhaps switch views or extend VideoView and override draw so that it calls the super class method while playing and does something different at other times.



来源:https://stackoverflow.com/questions/22402746/setting-background-colour-for-videoview-hides-the-video

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!