0
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.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"
    android:padding="10dp"
    tools:backgroundTint="#ff00ffff">

    <View
        android:id="@+id/spc_core_t"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:background="#ff00ff00"
        app:layout_constraintBottom_toTopOf="@+id/spc_core"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_weight="1" />

    <View
        android:id="@+id/spc_core_b"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:background="#ff0000ff"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/spc_core"
        app:layout_constraintVertical_weight="1" />

    <View
        android:id="@+id/spc_core"
        android:layout_width="wrap_content"
        android:layout_height="0dp"
        android:background="#ffff0000"
        app:layout_constraintBottom_toTopOf="@+id/spc_core_b"
        app:layout_constraintTop_toBottomOf="@+id/spc_core_t"
        app:layout_constraintVertical_weight="6" />

</android.support.constraint.ConstraintLayout>
  1. This is my code, but it doesn't displayed.
  2. When I changed app:layout_constraintVertical_weight to other value, all is OK.
  3. And I tried other combination, all 1:6:1, 2:12:2, and so on are didn't work, too.
  4. My present temporary solution is change 6 to 6.00001

But now I wonder know why this happened.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
TechQI
  • 3
  • 1

1 Answers1

0

I don't know why this is happening, but I was able to reproduce it when I was using version 1.0.2 of the constraint layout library. However, I was not able to reproduce it using version 1.1.0 of the library.

Change your build.gradle file to use version 1.1.0:

compile 'com.android.support.constraint:constraint-layout:1.1.0-beta4'
Ben P.
  • 52,661
  • 6
  • 95
  • 123