'ComposeView with dynamic height flickering inside ConstraintLayout

I have a ComposeView inside a ConstraintLayout like that:

    <androidx.compose.ui.platform.ComposeView
        android:id="@+id/compose"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="16dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent" />

And this ComposeView expands with AnimatedVisibility. I am getting a visual glitch that I can't figure out what is causing it.

When I use the same component inside a Compose activity, without the ComposeView integration, it works fine

Since I can not upload a video here in stackoverflow, I created a minimal example to reproduce it and put a video on README at github https://github.com/GabrielLasso/jetpack-compose-flickering/tree/master



Solution 1:[1]

I set

android:layout_height="wrap_content"

And it worked

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 g_lasso