官方文档:VideoView

来源:互联网 发布:三菱伺服软件序列号 编辑:程序博客网 时间:2024/05/18 01:55

继承关系

android.view.SurfaceView

android.widget.VideoView

今天有心情先根据官方文档学习一下VideoView,之后有空会学习下SurfaceView的。一定一定!!!

1.类的概述

Displays a video file. The VideoView class can load images from various sources (such as resources or content providers), takes care of computing its measurement from the video so that it can be used in any layout manager, and provides various display options such as scaling and tinting.

Note: VideoView does not retain its full state when going into the background. In particular, it does not restore the current play state, play position, selected tracks, or any subtitle tracks added via addSubtitleSource(). Applications should save and restore these on their own in onSaveInstanceState(Bundle) and onRestoreInstanceState(Bundle).

Also note that the audio session id (from getAudioSessionId()) may change from its previously returned value when the VideoView is restored.

1.1彩笔开始翻译啦

展示一个视频文件,这个VideoView类可以从各种资源(例如资源或者内容提供者)中加载图像,能够从视频忘准确测量它的尺寸以便于它能够被用在任何布局管理器中,并且提供各种显示选项,例如缩放和调色。

注意:当VideoView进入后台时不能保留他的全部状态。尤其是它不能还原当前播放状态,播放位置,和任何通过addSubtitleSource()方法添加过来的字幕轨迹。应用可以保存和还原这些配置在onSaveInstanceState(Bundle) and onRestoreInstanceState(Bundle)方法。

还需要注意audio session id (这个方法获取的getAudioSessionId())当VideoView还原的时候可能和之前返回值不一样。

2.具体方法查阅相关文档

VideoView-API


0 0