我正在尝试在中心的相对布局内设置视频 View 的自定义高度和宽度,顶部和底部包含其他布局。我面临的问题是视频 View 没有选择我提供的宽度和高度的大小。它显示它的视频大小可能是,但我希望它准确显示我设置的大小。我将视频 View 放置在 xml 布局中,因此如果有任何解决方法或者我遗漏了什么,请指导我。这是下面的布局标签
<RelativeLayout
android:id="@+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="640dp"
android:layout_marginTop="120dp" >
<VideoView
android:id="@+id/videoView1"
android:layout_width="match_parent"
android:layout_height="640dp"
/>
</RelativeLayout>
最佳答案
试试这个:
<RelativeLayout
android:id="@+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="640dp"
android:layout_marginTop="120dp" >
<VideoView
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">
</RelativeLayout>
关于安卓视频观看尺寸,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15331657/