视频视图在Android中旋转90度

Hem*_*tvc 7 android

我想在90度旋转视频.

当前我旋转布局但视频无法播放.XML

<LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="horizontal"
        android:rotation="90" >

        <VideoView
            android:id="@+id/videoView"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent" />
    </LinearLayout>
Run Code Online (Sandbox Code Playgroud)

java的

videoView = (VideoView) findViewById(R.id.videoView);

          final Uri videoUri = Uri.parse(
               Environment.getExternalStorageDirectory().getAbsolutePath()+"/UnoPlayList/restaurant_menu_pro_mkv.mkv");

       videoView.setVideoPath(Environment.getExternalStorageDirectory().getAbsolutePath()+"/UnoPlayList/restaurant_menu_pro_mkv.mkv");
       //videoView.setRotation(180);
    //  videoView.setVideoURI(videoUri);
      videoView.start();
Run Code Online (Sandbox Code Playgroud)

有没有办法旋转视频.

例如:https: //play.google.com/store/apps/details?id = com.mycall.videorotate&hl = en

请帮我.

小智 -4

无需设置视频视图的旋转即可

          videoView.setRotation(90f);

          (or)


<VideoView
    android:id="@+id/videoView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_centerVertical="true"
    android:rotation="90" />
Run Code Online (Sandbox Code Playgroud)

  • 它会显示黑屏,因为 videoView 本质上使用表面视图。由于 SurfaceView 的内容并不存在于应用程序的窗口中,因此无法有效地对其进行转换(移动、缩放、旋转)。 (2认同)