2.0.2版本的constraint layout和它的dimension ratio属性发生了什么变化?

What happened to constraint layout and its dimension ratio attribute in 2.0.2 version?

我有一个像这样的 ImageView 设置

<ImageView
    android:layout_width="0dp"
    android:layout_height="@dimen/video_file_item_image_height"
    android:background="@color/black"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintDimensionRatio="16:9"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent" />

implementation 'androidx.constraintlayout:constraintlayout:2.0.1'

看起来像这样

但是

implementation 'androidx.constraintlayout:constraintlayout:2.0.2'

ImageView 不可见

更新

版本 2.0.3 它仍然没有修复,只有当你没有为高度设置 dp 时它才有效(例如你设置 wrap_content 而不是)并且 app:layout_constraintEnd_toEndOf= 也是必需的,但它有效那么不同的是,我需要在 DPI 中设置高度!它在 2.0.1 中是这样工作的,不需要设置 app:layout_constraintEnd_toEndOf=

这似乎是一个已知问题:https://issuetracker.google.com/issues/170313444

推荐的解决方法是将此添加到您的 ConstraintLayout 标签中:

app:layout_optimizationLevel="cache_measures"