在res/目录下创建raw文件夹
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/90bd5017f116feab748a5a82e6576386.png)
MediaActivity.java
VideoView videoView = (VideoView)findViewById(R.id.videoView);
videoView.setMediaController(new MediaController(this));
Uri rawUri = Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.video02);
videoView.setVideoURI(rawUri);
videoView.start();
videoView.requestFocus();
activity.media.java
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="300dp">
<VideoView
android:id="@+id/videoView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
</LinearLayout>