相对布局高度设置为 match_parent 作为 wrap_content

Relative layout height set to match_parent work as wrap_content

我有一个 relative layout,它有 ScrollView,它包含另一个 RelativeLayout。子相对布局 layout_height 设置为 match_parent 但它的反应设置为 wrap_content

这里是xml代码

<RelativeLayout 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"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    tools:context="com.digitnomics.isite.Signage"
    tools:showIn="@layout/activity_signage">

    <ScrollView
        android:id="@+id/scrollView2"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent">

此处为布局预览

ScrollView 设置为 match_parent

Child RelativeLayout 设置为 match_parent

如何强制 Child Relative 布局 layout_height 填满整个高度?

在你的 ScrollView 集中

android:fillViewport="true"