Android 约束布局在底部有额外的空间
我正在实现一个在滚动视图内部使用约束布局的视图。我正在尝试使用Android 约束布局在底部有额外的空间,android,android-layout,android-constraintlayout,Android,Android Layout,Android Constraintlayout,我正在实现一个在滚动视图内部使用约束布局的视图。我正在尝试使用app:layout\u constraint bottom\u toBottomOf=“parent将视图与父视图底部对齐,但是正如您在图片中所看到的,我的视图下方有额外的空白。蓝色视图下方的空白。有人可以指导我如何删除底部的额外空白。提前感谢 这是密码 <android.support.constraint.ConstraintLayout android:layout_width="match_parent"
app:layout\u constraint bottom\u toBottomOf=“parent
将视图与父视图底部对齐,但是正如您在图片中所看到的,我的视图下方有额外的空白。蓝色视图下方的空白。有人可以指导我如何删除底部的额外空白。提前感谢
这是密码
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView
android:id="@+id/scrollView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:requiresFadingEdge="vertical"
android:fadingEdgeLength="90dp"
android:fadingEdge="vertical"
android:fillViewport="true"
>
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<ImageView
android:id="@+id/image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minHeight="275dp"
android:scaleType="center"
android:src="@drawable/bubble_exclaimation"
app:layout_constraintBottom_toTopOf="@id/content_layout"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<android.support.constraint.ConstraintLayout
android:id="@+id/content_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@+id/image"
android:background="@android:color/holo_blue_dark"
android:paddingBottom="15dp"
>
<TextView
android:id="@+id/title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/title"
android:textSize="17sp"
app:layout_constraintBottom_toTopOf="@+id/body"
app:layout_constraintLeft_toLeftOf="@+id/left_guideline"
app:layout_constraintRight_toLeftOf="@+id/right_guideline"
app:layout_constraintTop_toBottomOf="parent" />
<TextView
android:id="@+id/body"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="13dp"
android:text="@string/content_small"
android:textSize="12sp"
app:layout_constraintLeft_toLeftOf="@+id/left_guideline"
app:layout_constraintRight_toLeftOf="@+id/right_guideline"
app:layout_constraintTop_toBottomOf="@+id/title" />
<android.support.constraint.Guideline
android:id="@+id/left_guideline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.11" />
<android.support.constraint.Guideline
android:id="@+id/right_guideline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.89" />
</android.support.constraint.ConstraintLayout>
</android.support.constraint.ConstraintLayout>
</ScrollView>
<View
android:id="@+id/block"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="10dp"
android:background="@android:color/holo_blue_dark"
app:layout_constraintTop_toBottomOf="@id/scrollView"
app:layout_constraintBottom_toBottomOf="parent"
/>
</android.support.constraint.ConstraintLayout>
从android:id=“@+id/content\u layout”中删除app:layout\u constrainttoop\u toBottomOf=“@+id/image”
为什么在编写layout\u constraintBottom\u toBottomOf=“parent
或layout\u constrainttoop\u tototopof=“parent
”时会发生这种情况?@mj使用这两个属性,将内容对齐到中心,就像相对布局一样,对齐\u botton和对齐\u顶部是视图,将内容包裹到屏幕中心对齐
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView
android:id="@+id/scrollView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fadingEdge="vertical"
android:fadingEdgeLength="90dp"
android:fillViewport="true"
android:requiresFadingEdge="vertical">
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minHeight="275dp"
android:scaleType="center"
android:src="@drawable/bubble_exclaimation"
app:layout_constraintBottom_toTopOf="@id/content_layout"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<android.support.constraint.ConstraintLayout
android:id="@+id/content_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/holo_blue_dark"
android:paddingBottom="15dp"
app:layout_constraintBottom_toBottomOf="parent">
<TextView
android:id="@+id/title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/title"
android:textSize="17sp"
app:layout_constraintBottom_toTopOf="@+id/body"
app:layout_constraintLeft_toLeftOf="@+id/left_guideline"
app:layout_constraintRight_toLeftOf="@+id/right_guideline"
app:layout_constraintTop_toBottomOf="parent" />
<TextView
android:id="@+id/body"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="13dp"
android:text="@string/content_small"
android:textSize="12sp"
app:layout_constraintLeft_toLeftOf="@+id/left_guideline"
app:layout_constraintRight_toLeftOf="@+id/right_guideline"
app:layout_constraintTop_toBottomOf="@+id/title" />
<android.support.constraint.Guideline
android:id="@+id/left_guideline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.11" />
<android.support.constraint.Guideline
android:id="@+id/right_guideline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.89" />
</android.support.constraint.ConstraintLayout>
</android.support.constraint.ConstraintLayout>
</ScrollView>
<View
android:id="@+id/block"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="10dp"
android:background="@android:color/holo_blue_dark"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/scrollView" />
</android.support.constraint.ConstraintLayout>