系统自带视频

        String uri = "android.resource://" + getActivity().getPackageName() + "/" + R.raw.xiaohuang;
//设置视频路径
videoView.setVideoURI(Uri.parse(uri));
// videoView.setVideoURI(Uri.parse(videoUrl1));
MediaController controller = new MediaController(getActivity());
videoView.setMediaController(controller);
controller.setAnchorView(videoView);

//开始播放视频
videoView.start();


<VideoView
android:id="@+id/videoView"

android:layout_width="300dp"
android:layout_height="match_parent"
/>
 
posted @ 2018-05-03 19:50  Ars灬木子  阅读(227)  评论(0编辑  收藏  举报