我在一个RelativeLayout中放置了一个ImageView和一个VideoView。
通过 scaleType="fitXY"
可以让ImageView缩放以填充整个布局。然而,VideoView没有类似的缩放属性。顺便说一下,我通过 setMediaController(null)
隐藏了视频控制器,只显示视频内容。是否可能将VideoView缩放而不保持纵横比?以下是布局示例。
<RelativeLayout
android:layout_width="280dp"
android:layout_height="200dp">
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/image"
android:scaleType="fitXY" />
<VideoView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/video"
android:visibility="invisible"
android:layout_centerInParent="true" />
</RelativeLayout>
<VideoView android:layout_width="280dp" android:layout_height="200dp"/>
,但得到了保持纵横比的结果。 - Jones