2013-02-14 74 views
2

我開發了一款使用VideoView播放視頻的媒體播放器。它工作正常,但它有一個問題,播放視頻底部有一個空白區域。你可以檢查我的代碼和播放器的屏幕截圖。請在這方面幫助我,我會非常感謝你。提前致謝。VideoView在Android中播放視頻時不覆蓋整個屏幕

enter image description here

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

嘗試:'的android:layout_width = 「FILL_PARENT」' '機器人:layout_height = 「FILL_PARENT」' – 2013-02-14 13:57:03

回答

5

這應該工作,它會伸展你的視頻,以填補所有的屏幕:

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