[android]代码库package com.example.day_15_videoview;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.widget.MediaController;
import android.widget.VideoView;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//初始化控件
VideoView videoView=(VideoView) findViewById(R.id.vv);
//添加路径
videoView.setVideoPath("mnt/sdcard/minion_08.mp4");
//获取媒体控制器
MediaController controller=new MediaController(this);
//设置媒体控制器
videoView.setMediaController(controller);
//绑定播放器
controller.setAnchorView(videoView);
//开始播放
videoView.start();
}
}