constraintlayout
constraintlayout copied to clipboard
Placeholder with a width of 0dp has consequences on the height of the content view
Tested CL versions: 2.0.4 and 2.1.3
When setting a width of 0dp on a Placeholder the content view (in this case a Button) has a much bigger height, or it's not visible, like if it's not taking into account the wrap_content height of the placeholder.
In this screenshot, you can see that the button it's too big in height and also the button text is not in the right position:

Code to reproduce:
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.constraintlayout.widget.Placeholder
android:id="@+id/placeholder1"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:placeholder_emptyVisibility="gone"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:content="@id/button1" />
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:lines="1"
android:text="Test" />
<View
android:id="@+id/red_view"
android:visibility="gone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/holo_red_dark"/>
</androidx.constraintlayout.widget.ConstraintLayout>