问题VideoView显示缩略图 [英] Issue displaying thumbnail image in VideoView

查看:2616
本文介绍了问题VideoView显示缩略图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用VideoView的网络视频,我也有一个位图对象包含相应的缩略图。现在我应该怎么设置位图的VideoView用于显示略图?

I'm using VideoView for a web video, and I also have a bitmap object contains the corresponding thumbnail image. Now how should I set the bitmap to the VideoView for displaying the thumnail?

我用

videoView.setBackgroundDrawable(new BitmapDrawable(getResources(), bitmap));

但是当我玩这个视频,视频没有显示,而是始终显示这种静态的缩略图。

But then when I play this video, the video doesn't show, instead it always show this static thumbnail image.

任何提示将AP preciated。谢谢你。

Any hints would be appreciated. Thanks.

推荐答案

VideoView SurfaceView 的子类,其中有一些特殊的行为在其显示的条款。 SurfaceView 内容实际上是在视图层次下方的窗口绘制和视图只是作为当前窗口中的孔,内容是可见的。正因为如此,如果应用任何视图本身(如背景),它实际上将Z-序上的视频内容的顶部。此外,如果你把下面的东西 VideoView ,也不会是因为这个洞。

VideoView is a subclass of SurfaceView, which has some special behaviors in terms of its display. SurfaceView contents are actually drawn in a window underneath the view hierarchy and the view simply acts as a hole in the current window so the contents are visible. Because of this, if you apply anything to the view itself (like a background), it will actually be Z-Ordered on top of the video content. In addition, if you place anything underneath the VideoView, it also will not be visible because of this "hole".

如果你想显示在这个领域,而视频是不是在玩的内容,它要么需要在对的 VideoView 的顶部设计了一个单独的View您可以隐藏/显示当视频播放状态改变,或者你需要设置/清除背景图像您设置在视频播放状态的变化。

If you want to display content in this space while the video is not playing, it will either need to be in a separate View laid out on top of the VideoView that you can hide/show when the video playback state changes, or you need to set/clear the background image you have set when the video playback state changes.

心连心!

这篇关于问题VideoView显示缩略图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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