Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Full Width Video View

I am trying to stretch my video view inside the linear layout to full screen but it doesn't match the device screen. Here is my code

<LinearLayout
     android:id="@+id/linearLayout1"
     android:layout_width="fill_parent"
     android:layout_height="720dp"
     android:layout_alignParentBottom="true"
     android:layout_alignParentLeft="true"
     android:layout_alignParentTop="true"
     android:layout_alignParentRight="true"
     android:layout_gravity="fill_horizontal"
     android:layout_marginTop="140dp" >

<VideoView
    android:id="@+id/videoView1"
    android:layout_width="fill_parent"
    android:layout_height="720dp" />

</LinearLayout>

There is always 10 to 15 dp space on left and right each. Also the Linear layout is not stretching to full screen. I want it to fill the screen in width.

like image 911
Jibran Khan Avatar asked Dec 11 '22 16:12

Jibran Khan


1 Answers

Actually there's no need to set width programmatically

android:layout_width="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"

Should suffice to fill the container with full width video view. And use match_parent instead of fill_parent. Hope this helps somebody.

like image 124
Torsten Ojaperv Avatar answered Dec 14 '22 07:12

Torsten Ojaperv