在我的活动中,我需要显示VideoView
实例(全屏),并使用缩放内容的按钮 - 类似于iOS媒体播放器的实例。我是说,例如缩放4:3内容以填充屏幕宽度,保持纵横比(从而有效地修剪内容的顶部/底部)。
我刚刚在VideoView
内进行了快速黑客/实验 - AbsoluteLayout
,超大,因此顶部/底部被修剪掉了。它有效,但真的感觉像是黑客。
也许我是瞎子,但是没有API可以解决问题。选择要在视图中显示的视频子矩形?
答案 0 :(得分:-4)
您可以使用以下代码使视频全部使用:
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center_horizontal">
<VideoView
android:id="@+id/myvideoid"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
</VideoView>
</LinearLayout>
在高度中使用匹配父级将使您的视频保持纵横比。 如果你想要的是填满屏幕,请访问http://blog.kasenlam.com/2012/02/android-how-to-stretch-video-to-fill.html