我试图打开这样的 mp4 视频:
VideoView myVideoView = new VideoView(this);
myVideoView.setVideoURI(Uri.parse(path[idImage]));
myVideoView.setLayoutParams(new LinearLayout.LayoutParams(
LayoutParams.FILL_PARENT,
LayoutParams.FILL_PARENT));
myVideoView.setMediaController(new MediaController(this));
myVideoView.requestFocus();
myVideoView.start();
但我在屏幕上什么也看不到。我错过了什么?
我的 xml 文件如下所示:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:background="#000000"
android:id="@+id/layout_main">
<ViewFlipper android:id="@+id/details"
android:layout_width="fill_parent" android:layout_height="fill_parent">
</ViewFlipper>
<VideoView android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:id="@+id/VideoView"></VideoView>
</LinearLayout>