我有一个滚动的内容,所以我在滚动视图中放置了一个约束布局,当我将一个图像放在约束布局中时,我遇到了一个问题,但是图像显示了一个从顶部开始的空间,比如下面的截图,我如何删除那个空间?
<?xml version="1.0" encoding="utf-8"?>
<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="match_parent">
<android.support.constraint.ConstraintLayout
android:id="@+id/constraintLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<!-- have whatever children you want inside -->
<ImageView
app:srcCompat="@drawable/main_header"
android:id="@+id/img_icon"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="#ffccbb"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintWidth_percent="1"
android:contentDescription="TODO" app:layout_constraintDimensionRatio="1:1"
app:layout_constraintHorizontal_bias="0.0" app:layout_constraintVertical_bias="0.0"/>
</android.support.constraint.ConstraintLayout>
</ScrollView>
https://stackoverflow.com/questions/56315199
复制相似问题