VideoView:全屏上doubleTap [英] VideoView: Fullscreen on doubleTap
问题描述
基本上,我想在我的应用程序做的是显示视频。
Basically, what I want to do in my application is displaying a video.
要实现这一目标的最佳工具似乎是一个VideoView。
The best tool to achieve this goal seem to be a VideoView.
所以我用这个code:
So I used this code:
<VideoView android:id="@+id/videoview" android:layout_width="50dip" android:layout_height="50dip"></VideoView>
在我的活动:
VideoView videoHolder = (VideoView)findViewById(R.id.videoview);
videoHolder.setMediaController(new MediaController(this));
videoHolder.setVideoURI(Uri.parse("android.resource://com.blabla.blabla/" + R.raw.blabla));
videoHolder.requestFocus();
videoHolder.start();
和该做的伎俩。
不幸的是,我期待在默认情况下有在我的布局视频的preVIEW(缩略图)
Unfortunately, I was expecting having a preview (thumbnail) of the video in my layout by default
所以,我删除了videoHolder.start();命令,但我只能得到一个blackscreen。在一个无形的区域攻丝时视频开始...
So , I removed the videoHolder.start(); command, but I can only get a blackscreen. The video start when tapping on an invisible zone...
第一个问题
这有可能开始之前,以显示VideoView视频的preVIEW?
Is that possible to display a preview of the video in the VideoView before starting it?
第二个问题
我贵方觉得喜欢上显示全屏视频的时候轻按两下的WebView,我怎样才能做到这一点?
I wuld like to display the video on Fullscreen when double tapping the webview, How can I achieve this?
感谢很多的任何帮助/链接/建议
Thank a lot for any help / link / suggestion
推荐答案
是的,你可以使用的 ThumbnailUtils :
Bitmap thumb = ThumbnailUtils.createVideoThumbnail(path,
MediaStore.Images.Thumbnails.MINI_KIND);
我还没有看到之前的应用程序切换到全屏。实际上,我不知道,如果是可以做到的(尤其是对于 VideoView
)。不过,你可能有一些运气下列方法之一:
I haven't really seen apps toggle into fullscreen before. I'm actually not sure if it can be done (especially for a VideoView
). However, you might have some luck with one of these methods:
- 按住
VideoView
在的FrameLayout
,然后改变其布局参数。 - 的叠加
VideoView
通过窗口#addContentView
。 - 隐藏(通过
Visibility.GONE
),你的其他意见,并让VideoView
来扩大其版图面积。
- Holding the
VideoView
in aFrameLayout
and then changing its layout parameters. - Overlaying the
VideoView
viaWindow#addContentView
. - Hiding (via
Visibility.GONE
) your other views and allowing theVideoView
to expand its layout area.
这篇关于VideoView:全屏上doubleTap的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!