adsl9002 2023-02-15 12:36 采纳率: 46.2%
浏览 36
已结题

videoView会有隐藏部分超出父布局

用的ConstraintLayout,第一排3个button横向平均分布,离顶16dp。
第二行videoView,高度wrap_content,我想让videoView离button16dp,离底部16dp,不知道要怎么设置才正确了。
1,同时设置到button下面和父局底部的限位,videoView会遮挡button和底部超出父布局;
2,单独设置离button下面限位,videoView会超出底部父布局;
3,单独设置离父布局底部限位,videoView会遮挡button,

img

activity_main.xml

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <Button
        android:id="@+id/btn1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/play"
        android:layout_marginTop="16dp"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toLeftOf="@id/btn2"
        app:layout_constraintTop_toTopOf="parent" />

    <Button
        android:id="@+id/btn2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/pause"
        android:layout_marginTop="16dp"
        app:layout_constraintLeft_toRightOf="@id/btn1"
        app:layout_constraintRight_toLeftOf="@id/btn3"
        app:layout_constraintTop_toTopOf="parent" />

    <Button
        android:id="@+id/btn3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/replay"
        android:layout_marginTop="16dp"
        app:layout_constraintLeft_toRightOf="@id/btn2"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <VideoView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="16dp"
        app:layout_constraintTop_toBottomOf="@id/btn2"
        app:layout_constraintBottom_toBottomOf="parent"
        android:layout_marginBottom="16dp"/>
    
</androidx.constraintlayout.widget.ConstraintLayout>
  • 写回答

3条回答 默认 最新

  • Halifax ‎ 2023-02-15 13:40
    关注
    
        <VideoView
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_marginTop="16dp"
            app:layout_constraintTop_toBottomOf="@id/btn2"
            app:layout_constraintBottom_toBottomOf="parent"
            android:layout_marginBottom="16dp"/>
    
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

问题事件

  • 已结题 (查看结题原因) 2月19日
  • 已采纳回答 2月15日
  • 修改了问题 2月15日
  • 创建了问题 2月15日

悬赏问题

  • ¥15 想问一下树莓派接上显示屏后出现如图所示画面,是什么问题导致的
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号