English | Site Directory

Android - An Open Handset Alliance Project

android.widget
public class

android.widget.VideoView

java.lang.Object
android.view.View Drawable.Callback KeyEvent.Callback
android.view.SurfaceView
android.widget.VideoView MediaController.MediaPlayerControl

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.

Summary

XML Attributes

Attribute name Related methods  
android:maxHeight setMaxHeight(int)
 
Makes the TextView be at most this many pixels tall

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". 

android:maxWidth setMaxWidth(int)
 
Makes the TextView be at most this many pixels wide

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". 

XML Attributes inherited from class android.view.View
Constants inherited from class android.view.View
Fields inherited from class android.view.View

Public Constructors

          VideoView(Context context)
          VideoView(Context context, AttributeSet attrs, Map inflateParams)
          VideoView(Context context, AttributeSet attrs, Map inflateParams, int defStyle)

Public Methods

        int  getBufferPercentage()
        int  getCurrentPosition()
        int  getDuration()
        boolean  isPlaying()
        boolean  onKeyDown(int keyCode, KeyEvent event)
Default implementation of KeyEvent.Callback.onKeyMultiple(): perform press of the view when KEYCODE_DPAD_CENTER or KEYCODE_NEWLINE is released, if the view is enabled and clickable.
        boolean  onTouchEvent(MotionEvent ev)
Implement this method to handle touch screen motion events.
        boolean  onTrackballEvent(MotionEvent ev)
Implement this method to handle trackball motion events.
        void  pause()
        int  resolveAdjustedSize(int desiredSize, int maxSize, int measureSpec)
        void  seekTo(int msec)
        void  setMaxHeight(int maxHeight)
An optional argument to supply a maximum height for this view.
        void  setMaxWidth(int maxWidth)
An optional argument to supply a maximum width for this view.
        void  setMediaController(MediaController controller)
        void  setOnCompletionListener(OnCompletionListener l)
Register a callback to be invoked when the end of a media file has been reached during playback.
        void  setVideoPath(String path)
        void  setVideoURI(Uri uri)
        void  start()
        void  stopPlayback()

Protected Methods

        void  onMeasure(int widthMeasureSpec, int heightMeasureSpec)

Measure the view and its content to determine the measured width and the measured height.

        boolean  setFrame(int l, int t, int r, int b)
Assign a size and position to this view.
Methods inherited from class android.view.SurfaceView
Methods inherited from class android.view.View