Reputation: 2114
I was having trouble getting some views to wrap to the correct height while matching constraints, and I managed to condense my issue down to a single text view.
For some reason, when I'm using layout_constrainedWidth and layout_constrainedHeight, they can't handle text views that just barely wrap onto the next line.
<?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:id="@+id/coordinator_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="64dp"
android:layout_marginBottom="8dp"
android:text="If a single word wraps onto the next line it is cut off one"
android:visibility="visible"
app:layout_constrainedHeight="true"
app:layout_constrainedWidth="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>
I'm actually using it on a scroll view that contains some text views, and it doesn't work at all unless I also apply it to the child views as well.
Is this a bug in Android?
Upvotes: 4
Views: 1703
Reputation: 2114
Yes, it was a bug in Android.
https://issuetracker.google.com/issues/123551995
Google marked it as resolved with the release of ConstraintLayout 2.0 beta 2
Upvotes: 2