小编Kon*_*gDa的帖子

ConstraintLayout 1.1.0与1.0.2不同,是不是一个bug?

如果我使用1.0.2,则3个图像的宽度是平均值,并且它们的高度由我设置的无线电计算.如果我使用1.1.0,它们的高度是0dp,我看不到任何东西,除非我设置
android:layout_height="match_parent"
在根目录中ConstraintLayout.

这是一个错误吗?这是我的代码:

<android.support.constraint.ConstraintLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <ImageView
        android:id="@+id/iv0"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:background="#FF0000"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toLeftOf="@+id/iv1"
        app:layout_constraintDimensionRatio="2:1"/>

    <ImageView
        android:id="@+id/iv1"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:background="#00FF00"
        app:layout_constraintDimensionRatio="2:1"
        app:layout_constraintLeft_toRightOf="@id/iv0"
        app:layout_constraintRight_toLeftOf="@+id/iv2"/>

    <ImageView
        android:id="@+id/iv2"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:background="#0000FF"
        app:layout_constraintDimensionRatio="2:1"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintLeft_toRightOf="@id/iv1"/>

</android.support.constraint.ConstraintLayout>
Run Code Online (Sandbox Code Playgroud)

android android-layout android-constraintlayout

5
推荐指数
1
解决办法
1140
查看次数