TextView
can't wrap_content
in ConstraintLayout
This behaviour has been fixed in version 1.1.0. Now TextView
will grow if the text is too long but still respect the constraint:
We will need either app:layout_constrainedWidth=”true”
or app:layout_constrainedHeight=”true”
<TextView
android:layout_width="wrap_content" <----
android:layout_height="wrap_content"
android:text="Hello this is an example with constraint width"
app:layout_constrainedWidth="true" <----
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="@+id/guideline_50"/>
TextView
doesn't seem to respect wrap_content
inside ConstraintLayout
(long text get cut off).
Solution, change with to 0dp:
android:layout_width="0dp"
app:layout_constraintWidth_default="wrap" //optional, seem to work fine without this in ConstraintLayout 1.0.2