您好,我有以下布局:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/myFrameLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/black" >
<VideoView
android:id="@+id/myVideoView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center" >
</VideoView>
</FrameLayout>
在代码的某处开始播放视频:
objVideoView.setVideoURI(uriVideo);
objVideoView.start();
视频在屏幕中央正确显示,但视频上下有白角。
无论我尝试什么(例如添加另一个 Framelayout 并使其在 Video prepare 上不可见)都没有帮助。更改 Video Vieo 布局以包装内容也无济于事。
我在想,这一定是一件简单的事情。 Videoview 是 Framelayout 的 subview ,所以应该没有角,因为布局是黑色的。即使有 wrapcontent 设置。
所以我需要帮助。
最佳答案
把它放在一个RelativeLayout中写成
<VideoView
android:id="@+id/myVideoView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:alignParentRight="true"
android:alignParentLeft="true"
android:alignParentTop="true"
android:alignParentBottom="true" >
关于Android VideoView 无法设置背景色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18367795/