使用SurfaceView实现视频播放:
1.在布局文件中实现布局:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<SurfaceView
android:id="@+id/sv"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="4"/>
<SeekBar
android:id="@+id/seekBar"
android:max="100"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.5"/>
<Button
android:id="@+id/one"
android:text="第一集"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="0.5"/>
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="0.5">
<Button
android:id="@+id/start"
android:text="开始"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Button
android:id="@+id/stop"
android:text="暂停"
android:layout_width="wrap_content"
android:layout_height="wrap_content