[我已经注意到ConstraintLayout
(版本1.1.3)的怪异行为,每当我尝试通过TextView
属性使用高度并将wrap_content
设置为layout_constrainedHeight
时,它都会隐藏true
的最后一行。
使用layout_constrainedHeight
:
没有layout_constrainedHeight
:
源代码:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.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">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:text="Lorem..."
app:layout_constrainedHeight="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
我以为,每当我想将wrap_content
与ConstraintLayout
结合使用时,都必须将layout_constrainedHeight
设置为true,但这有时会给我带来怪异的错误。我想念什么吗?
编辑
如果我删除TextView
周围的空白,效果很好。似乎ConstraintLayout
对wrap_content
和边距有误。