Android ScrollView底部的空白区域

Android ScrollView底部的空白区域,android,android-layout,android-scrollview,Android,Android Layout,Android Scrollview,我试图在ScrollView中创建一个带有ConstraintLayout的可滚动活动 但它在底部显示了一个空白 Android Studio Blueprint上没有显示任何内容 我的XML是这样的: <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://

我试图在ScrollView中创建一个带有ConstraintLayout的可滚动活动

但它在底部显示了一个空白

Android Studio Blueprint上没有显示任何内容

我的XML是这样的:

<ScrollView 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="wrap_content"
android:clipToPadding="false"
android:layout_weight="1"
android:fillViewport="true">

<android.support.constraint.ConstraintLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    tools:context="com.bonecadetrapo.imagensprincipal"
    tools:layout_editor_absoluteX="0dp"
    tools:layout_editor_absoluteY="25dp">

    <android.support.constraint.Guideline
        android:id="@+id/guideline10"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        app:layout_constraintGuide_begin="929dp" />

    <android.support.v7.widget.CardView
        android:id="@+id/cardview1"
        android:layout_width="164dp"
        android:layout_height="197dp"
        android:layout_marginBottom="300dp"
        android:layout_marginStart="17dp"
        android:layout_marginTop="8dp"
        android:clickable="true"
        android:elevation="3dp"
        android:focusable="true"
        android:foreground="?android:selectableItemBackground"
        app:layout_constraintBottom_toTopOf="@+id/guideline10"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="@+id/guideline3"
        app:layout_constraintVertical_bias="0.0">

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

            <ImageView
                android:id="@+id/thumbnail"
                android:layout_width="164dp"
                android:layout_height="170dp"
                android:layout_marginLeft="3dp"
                android:layout_marginRight="3dp"
                android:layout_marginTop="3dp"
                android:background="?attr/selectableItemBackgroundBorderless"
                android:clickable="true"
                android:scaleType="centerInside"
                app:srcCompat="@drawable/one" />

            <TextView
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_alignParentBottom="true"
                android:layout_alignParentLeft="true"
                android:layout_alignParentStart="true"
                android:layout_below="@id/thumbnail"
                android:paddingLeft="10dp"
                android:paddingRight="10dp"
                android:paddingTop="0dp"
                android:text="example 1" />

        </RelativeLayout>
    </android.support.v7.widget.CardView>

    <android.support.v7.widget.CardView
        android:id="@+id/cardview2"
        android:layout_width="164dp"
        android:layout_height="197dp"
        android:layout_marginBottom="300dp"
        android:layout_marginEnd="24dp"
        android:layout_marginStart="17dp"
        android:layout_marginTop="8dp"
        android:clickable="true"
        android:elevation="3dp"
        android:focusable="true"
        android:foreground="?android:selectableItemBackground"
        app:layout_constraintBottom_toTopOf="@+id/guideline10"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.64"
        app:layout_constraintStart_toStartOf="@+id/guideline5"
        app:layout_constraintTop_toTopOf="@+id/guideline3"
        app:layout_constraintVertical_bias="0.0">

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

            <ImageView
                android:id="@+id/thumbnail2"
                android:layout_width="164dp"
                android:layout_height="170dp"
                android:layout_marginLeft="3dp"
                android:layout_marginRight="3dp"
                android:layout_marginTop="3dp"
                android:background="?attr/selectableItemBackgroundBorderless"
                android:clickable="true"
                android:scaleType="centerInside"
                app:srcCompat="@drawable/two" />

            <TextView
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_alignParentBottom="true"
                android:layout_alignParentLeft="true"
                android:layout_alignParentStart="true"
                android:layout_below="@id/thumbnail2"
                android:paddingLeft="10dp"
                android:paddingRight="10dp"
                android:paddingTop="0dp"
                android:text="example 2" />

        </RelativeLayout>
    </android.support.v7.widget.CardView>

    <android.support.v7.widget.CardView
        android:id="@+id/cardview5"
        android:layout_width="164dp"
        android:layout_height="160dp"
        android:layout_marginBottom="170dp"
        android:layout_marginEnd="8dp"
        android:layout_marginLeft="16dp"
        android:layout_marginStart="8dp"
        android:layout_marginTop="24dp"
        android:clickable="true"
        android:elevation="3dp"
        android:focusable="true"
        android:foreground="?android:selectableItemBackground"
        app:layout_constraintBottom_toTopOf="@+id/guideline10"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.039"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/cardview3"
        app:layout_constraintVertical_bias="0.0">

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

            <ImageView
                android:id="@+id/thumbnail5"
                android:layout_width="164dp"
                android:layout_height="130dp"
                android:layout_marginLeft="6dp"
                android:layout_marginRight="6dp"
                android:layout_marginTop="6dp"
                android:adjustViewBounds="false"
                android:background="?attr/selectableItemBackgroundBorderless"
                android:clickable="true"
                android:cropToPadding="false"
                android:scaleType="fitXY"
                app:srcCompat="@drawable/exampletwo" />

            <TextView
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_alignParentBottom="true"
                android:layout_alignParentLeft="true"
                android:layout_alignParentStart="true"
                android:layout_below="@id/thumbnail5"
                android:paddingLeft="10dp"
                android:paddingRight="10dp"
                android:paddingTop="0dp"
                android:text="Example 2" />

        </RelativeLayout>
    </android.support.v7.widget.CardView>

    <android.support.design.widget.AppBarLayout
        android:id="@+id/appbar"
        android:layout_width="384dp"
        android:layout_height="wrap_content"
        android:paddingTop="@dimen/appbar_padding_top"
        android:theme="@style/AppTheme.Negocio">

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:background="?attr/colorPrimary"
            app:layout_scrollFlags="scroll|enterAlways"
            app:popupTheme="@style/AppTheme.Negocio"
            app:title="Negocio">

        </android.support.v7.widget.Toolbar>

    </android.support.design.widget.AppBarLayout>

    <android.support.constraint.Guideline
        android:id="@+id/guideline3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        app:layout_constraintGuide_percent="0.06" />

    <android.support.constraint.Guideline
        android:id="@+id/guideline5"
        android:layout_width="wrap_content"
        android:layout_height="929dp"
        android:orientation="vertical"
        app:layout_constraintGuide_begin="204dp" />

    <android.support.constraint.Guideline
        android:id="@+id/guideline6"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        app:layout_constraintGuide_end="17dp" />
</android.support.constraint.ConstraintLayout>

我正在使用Android Studio Beta 7和Oreo。
我在谷歌上尝试了所有的解决方案,没有一个有效。

我用这段代码修复了它

<ScrollView 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="wrap_content"
    android:clipToPadding="false"
    android:layout_weight="1"
    android:fillViewport="true">

    <android.support.constraint.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        tools:context="com.bonecadetrapo.imagensprincipal"
        tools:layout_editor_absoluteX="0dp"
        tools:layout_editor_absoluteY="25dp">

        <android.support.constraint.Guideline
            android:id="@+id/guideline10"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            app:layout_constraintGuide_begin="929dp" />

        <android.support.v7.widget.CardView
            android:id="@+id/cardview1"
            android:layout_width="164dp"
            android:layout_height="197dp"
            android:layout_marginBottom="300dp"
            android:layout_marginStart="17dp"
            android:layout_marginTop="8dp"
            android:clickable="true"
            android:elevation="3dp"
            android:focusable="true"
            android:foreground="?android:selectableItemBackground"
            app:layout_constraintBottom_toTopOf="@+id/guideline10"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="@+id/guideline3"
            app:layout_constraintVertical_bias="0.0"
            android:layout_marginLeft="17dp">

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

                <ImageView
                    android:id="@+id/thumbnail"
                    android:layout_width="164dp"
                    android:layout_height="170dp"
                    android:layout_marginLeft="3dp"
                    android:layout_marginRight="3dp"
                    android:layout_marginTop="3dp"
                    android:background="?attr/selectableItemBackgroundBorderless"
                    android:clickable="true"
                    android:scaleType="centerInside"
                    app:srcCompat="@drawable/one" />

                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_alignParentBottom="true"
                    android:layout_alignParentLeft="true"
                    android:layout_alignParentStart="true"
                    android:layout_below="@id/thumbnail"
                    android:paddingLeft="10dp"
                    android:paddingRight="10dp"
                    android:paddingTop="0dp"
                    android:text="example 1" />

            </RelativeLayout>

            <android.support.constraint.Guideline
                android:id="@+id/guideline6"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                app:layout_constraintGuide_end="17dp" />
        </android.support.v7.widget.CardView>

        <android.support.v7.widget.CardView
            android:id="@+id/cardview2"
            android:layout_width="164dp"
            android:layout_height="197dp"
            android:layout_marginBottom="300dp"
            android:layout_marginEnd="24dp"
            android:layout_marginStart="17dp"
            android:layout_marginTop="8dp"
            android:clickable="true"
            android:elevation="3dp"
            android:focusable="true"
            android:foreground="?android:selectableItemBackground"
            app:layout_constraintBottom_toTopOf="@+id/guideline10"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintHorizontal_bias="0.64"
            app:layout_constraintStart_toStartOf="@+id/guideline5"
            app:layout_constraintTop_toTopOf="@+id/guideline3"
            app:layout_constraintVertical_bias="0.0"
            android:layout_marginRight="24dp"
            android:layout_marginLeft="17dp">

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

                <ImageView
                    android:id="@+id/thumbnail2"
                    android:layout_width="164dp"
                    android:layout_height="170dp"
                    android:layout_marginLeft="3dp"
                    android:layout_marginRight="3dp"
                    android:layout_marginTop="3dp"
                    android:background="?attr/selectableItemBackgroundBorderless"
                    android:clickable="true"
                    android:scaleType="centerInside"
                    app:srcCompat="@drawable/two" />

                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_alignParentBottom="true"
                    android:layout_alignParentLeft="true"
                    android:layout_alignParentStart="true"
                    android:layout_below="@id/thumbnail2"
                    android:paddingLeft="10dp"
                    android:paddingRight="10dp"
                    android:paddingTop="0dp"
                    android:text="example 2" />

            </RelativeLayout>
        </android.support.v7.widget.CardView>

        <android.support.v7.widget.CardView
            android:id="@+id/cardview5"
            android:layout_width="164dp"
            android:layout_height="160dp"
            android:layout_marginEnd="8dp"
            android:layout_marginLeft="16dp"
            android:layout_marginStart="8dp"
            android:layout_marginTop="24dp"
            android:clickable="true"
            android:elevation="3dp"
            android:focusable="true"
            android:foreground="?android:selectableItemBackground"
            app:layout_constraintBottom_toTopOf="@+id/guideline10"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintHorizontal_bias="0.039"
            app:layout_constraintLeft_toLeftOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@+id/cardview2"
            app:layout_constraintVertical_bias="0.0">

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

                <ImageView
                    android:id="@+id/thumbnail5"
                    android:layout_width="164dp"
                    android:layout_height="130dp"
                    android:layout_marginLeft="6dp"
                    android:layout_marginRight="6dp"
                    android:layout_marginTop="6dp"
                    android:adjustViewBounds="false"
                    android:background="?attr/selectableItemBackgroundBorderless"
                    android:clickable="true"
                    android:cropToPadding="false"
                    android:scaleType="fitXY"
                    app:srcCompat="@drawable/exampletwo" />

                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_alignParentBottom="true"
                    android:layout_alignParentLeft="true"
                    android:layout_alignParentStart="true"
                    android:layout_below="@id/thumbnail5"
                    android:paddingLeft="10dp"
                    android:paddingRight="10dp"
                    android:paddingTop="0dp"
                    android:text="Example 2" />

            </RelativeLayout>
        </android.support.v7.widget.CardView>

        <android.support.design.widget.AppBarLayout
            android:id="@+id/appbar"
            android:layout_width="384dp"
            android:layout_height="wrap_content">

            <android.support.v7.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:background="?attr/colorPrimary"
                app:layout_scrollFlags="scroll|enterAlways"
                app:title="Negocio">

            </android.support.v7.widget.Toolbar>

        </android.support.design.widget.AppBarLayout>

        <android.support.constraint.Guideline
            android:id="@+id/guideline3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            app:layout_constraintGuide_percent="0.06" />

        <android.support.constraint.Guideline
            android:id="@+id/guideline5"
            android:layout_width="wrap_content"
            android:layout_height="929dp"
            android:orientation="vertical"
            app:layout_constraintGuide_begin="204dp" />

    </android.support.constraint.ConstraintLayout>
</ScrollView>


您的ScrollView和ConstraintLayout都有高度换行内容,您是否尝试匹配\u parent?@RobertoMartucci它给出了相同的结果我看不出您发布的两个图像之间有任何差异。不幸的是,它仍然在底部显示空白。在您上次的cardview中,您有这样一行:“app:layout\u ConstraintToBottomof”=“@+id/cardview3”,但您没有任何名为cardview3的视图。因此,将其更改为cardview的id,该id位于最后一个cardview的上方,然后它将位于该视图的下方,该视图现在是一个空白。