0
如何在Android中自定義VideoView界面的外觀?我特別想用我自己的替換進度條,黃色背景和媒體(暫停/播放)按鈕。自定義Android VideoView界面的外觀和感覺
XML
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<VideoView
android:id="@+id/surface_view"
android:layout_width="320px"
android:layout_height="240px"/>
</LinearLayout>
代碼
public class VideoViewExample extends Activity {
private VideoView mVideoView;
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.main);
mVideoView = (VideoView) findViewById(R.id.surface_view);
mVideoView.setVideoURI(Uri.parse("android.resource://" + getPackageName() +"/"+R.raw.sm));
mVideoView.setMediaController(new MediaController(this));
mVideoView.requestFocus();
mVideoView.start();
}
}