【发布时间】:2015-07-30 12:23:55
【问题描述】:
我有一个单一尺寸的视频,无论屏幕大小如何,我都希望它始终显示全尺寸。同时我想保持该视频的纵横比,这样它就不会拉伸,我会造成不好的外观。
我可以实现这样的拉伸效果,但视频看起来很糟糕:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<VideoView android:id="@+id/videoViewRelative"
android:layout_alignParentTop="true"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
</VideoView>
</RelativeLayout>
在我的这种情况下,向用户显示整个视频并不重要,所以我需要一些类似 ImageView 的方法:
android:scaleType="centerCrop"
VideoView 有什么作物替代品吗?谢谢你:)
【问题讨论】:
-
更好地使用一些库检查这个答案stackoverflow.com/a/38971707/1153703