VideoView不填布局 [英] VideoView does not fill layout

查看:326
本文介绍了VideoView不填布局的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我作了videoview并在屏幕的底部有另一个相对布局。在模拟器它显示确定应该如何,但是当我启动应用它does not。

从模拟器图片

现在,当我启动它表明我这样的布局

布局启动应用

我在做错事背后的code?

 <?XML版本=1.0编码=UTF-8&GT?;
<的RelativeLayout的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
    机器人:layout_width =match_parent
    机器人:layout_height =match_parent>    < VideoView
        机器人:ID =@ + ID / VIDEO_VIEW
        机器人:layout_width =match_parent
        机器人:layout_height =match_parent
        机器人:layout_above =@ + ID / buttonsLayout/>    < RelativeLayout的
        机器人:ID =@ + ID / buttonsLayout
        机器人:layout_width =match_parent
        机器人:layout_height =WRAP_CONTENT
        机器人:layout_alignParentBottom =真
        机器人:背景=#404040
        机器人:方向=横向>        < ImageView的
            机器人:ID =@ + ID / button_accept_video
            机器人:layout_width =50dp
            机器人:layout_height =50dp
            机器人:layout_alignParentLeft =真
            机器人:layout_centerVertical =真
            机器人:layout_margin =10dp
            机器人:SRC =@的mipmap /接受/>        < ImageView的
            机器人:ID =@ + ID / button_reject_video
            机器人:layout_width =50dp
            机器人:layout_height =50dp
            机器人:layout_alignParentRight =真
            机器人:layout_centerVertical =真
            机器人:layout_margin =10dp
            机器人:SRC =@的mipmap /拒绝/>    < / RelativeLayout的>
< / RelativeLayout的>


解决方案

尝试 VideoView 添加以下属性。

 的android:layout_alignParentLeft =真
机器人:layout_alignParentRight =真
机器人:layout_alignParentTop =真
机器人:layout_alignParentBottom =真

这以供参考。

I made a videoview and at the bottom of the screen there is another relative layout. In simulator it shows ok how it should be, but when i launch the app it doesnt.

Image from emulator

Now when i launch it shows me such layout

Layout when launching app

Am i doing something wrong in the code behind?

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

解决方案

Try adding the following attributes in VideoView.

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

Check this for reference.

这篇关于VideoView不填布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆