我试图拉伸视频以填充视频视图。目标是创建视图,在设备中看起来像第一张图片(就像它在布局预览中看到的一样)。拉伸填充VideoView,纵横比VideoView
这个问题的大部分答案都是指this link。
我试过这个,但我仍然没有填写视频视图。
这是我的布局代码:
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@drawable/search_gren_screen">
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
android:id="@+id/go_back"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_weight="1"
android:onClick="onclick"
android:text="Try again" />
android:id="@+id/back_to_pick_song"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="Select another song"
android:onClick="onclick" />
android:id="@+id/btn_continue"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:onClick="onclick"
android:text="Amazing, continue!" />
android:layout_width="fill_parent"
android:layout_height="fill_parent">
android:id="@+id/videoView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_gravity="center" />
这里有我的声明布局的预览:
![](https://img.laitimes.com/img/__Qf2AjLwojIjJCLyojI0JCLicmbw5ybKRXYi9CXt92YuIXdn1Waus2YhR3cuk2Lc9CX6MHc0RHaiojIsJye.png)
然而,在设备上的结果是不同的:
2013-04-24
idan
+0
您的布局代码可以满足您的需求。但请记住,VideoView将相对于其中播放的视频缩小/伸展。 –
2013-04-24 12:11:46
+0
好的,所以我需要改变媒体记录器的宽高比来表示增加mMediaRecorder.setVideoSize(640,480);我尝试这个,它不工作...? –
2013-04-24 12:27:34
+0
检查这个答案http://stackoverflow.com/a/38971707/1153703 –
2016-08-16 09:52:15