设置VideoView的背景色可隐藏视频 [英] Setting background colour for VideoView hides the video

查看:504
本文介绍了设置VideoView的背景色可隐藏视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的应用程序中使用VideoView,并且当我使用布局属性或代码本身设置背景色时,背景色被放置在视频的顶部,而我看不到它.

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.

推荐答案

VideoView扩展了SurfaceView,它依赖于

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.

这篇关于设置VideoView的背景色可隐藏视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆