约束布局中如何竖直居中
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintTop_toTopOf="parent"
<androidx.constraintlayout.widget.ConstraintLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <androidx.appcompat.widget.AppCompatTextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="标题" android:textColor="@color/color_73797f" android:textSize="@dimen/sp_14" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintTop_toTopOf="parent" tools:ignore="MissingConstraints" /> <androidx.appcompat.widget.AppCompatImageView android:id="@+id/iv_delete" android:layout_width="@dimen/dp_30" android:layout_height="@dimen/dp_30" android:paddingVertical="@dimen/dp_5" android:paddingLeft="@dimen/dp_5" android:scaleType="fitCenter" android:src="@mipmap/icon_im_delete_red" app:layout_constraintRight_toRightOf="parent" tools:ignore="MissingConstraints" /> </androidx.constraintlayout.widget.ConstraintLayout>