在Android中播放视频时,VideoView无法覆盖整个屏幕

3
我使用VideoView开发了一个媒体播放器来播放视频。它工作得很好,但是有一个问题,就是播放视频底部有一个白色空间。您可以查看我的代码和播放器的屏幕截图。请在这方面帮助我,我将非常感激您。提前致谢。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    >

    <VideoView 
        android:id="@+id/video_view" 
        android:layout_width="match_parent"
        android:layout_height="match_parent"
    />

</LinearLayout>

尝试使用以下代码:android:layout_width="fill_parent" android:layout_height="fill_parent" - Milos Cuculovic
1个回答

8

这应该可以实现,它会将您的视频拉伸以填满整个屏幕:

<?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>

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接