VideoView does not fill out the layout

I made a video, and at the bottom of the screen there is another relative layout. In the simulator, it shows how it should be, but when I run the application, it does not.

Image from emulator

Now when I run, it shows me such a layout

Layout at application launch

Am I doing something wrong in the code?

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    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"
        android:layout_above="@+id/buttonsLayout" />

    <RelativeLayout
        android:id="@+id/buttonsLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:background="#404040"
        android:orientation="horizontal">

        <ImageView
            android:id="@+id/button_accept_video"
            android:layout_width="50dp"
            android:layout_height="50dp"
            android:layout_alignParentLeft="true"
            android:layout_centerVertical="true"
            android:layout_margin="10dp"
            android:src="@mipmap/accept" />

        <ImageView
            android:id="@+id/button_reject_video"
            android:layout_width="50dp"
            android:layout_height="50dp"
            android:layout_alignParentRight="true"
            android:layout_centerVertical="true"
            android:layout_margin="10dp"
            android:src="@mipmap/reject" />

    </RelativeLayout>
</RelativeLayout>
+4
source share
2 answers

Try adding the following attributes to VideoView.

android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_alignParentBottom="true"

Check this for reference.

+3
source

try it

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

Hope this helps you

+1
source

Source: https://habr.com/ru/post/1622088/


All Articles