title: XML constraint layout: Elements placed on top of each other, fix?
body: <p>My XML code looks like this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;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:id="@+id/constraintLayout"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          tools:context=".BottomNavActivity"&gt;
  
      &lt;TextView
              android:id="@+id/message"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:paddingLeft="10dp"
              android:paddingTop="10dp"
              android:paddingBottom="10dp"
              android:background="#CCB0F0"
              android:text="Map"
              android:textSize="20sp"
              android:textStyle="bold"
              app:layout_constraintLeft_toLeftOf="parent"
              app:layout_constraintTop_toTopOf="parent"
              app:layout_constraintBottom_toTopOf="@id/idCardView" app:layout_constraintEnd_toEndOf="parent"/&gt;
  
      &lt;android.support.v7.widget.CardView
              android:id="@+id/idCardView"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:layout_margin="5dp"
              android:layout_marginTop="5dp"
              app:cardCornerRadius="4dp" app:layout_constraintTop_toTopOf="parent"
              tools:layout_editor_absoluteX="5dp" android:layout_marginBottom="332dp"
              app:layout_constraintTop_toBottomOf="@+id/message"
              app:layout_constraintBottom_toTopOf="@+id/container"&gt;
          &lt;fragment android:id="@+id/autocomplete_fragment"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:name="com.google.android.libraries.places.widget.AutocompleteSupportFragment"
          /&gt;
      &lt;/android.support.v7.widget.CardView&gt;
  
      &lt;android.support.constraint.ConstraintLayout
              android:layout_width="0dp"
              android:layout_height="0dp"
              android:id="@+id/container"
              app:layout_constraintTop_toBottomOf="@+id/idCardView"
              app:layout_constraintBottom_toTopOf="@+id/navigation" app:layout_constraintEnd_toEndOf="parent"
              app:layout_constraintStart_toStartOf="parent"
              app:layout_constraintHorizontal_bias="0.0" app:layout_constraintVertical_bias="1.0"&gt;
  
      &lt;/android.support.constraint.ConstraintLayout&gt;
  
      &lt;android.support.design.widget.BottomNavigationView
              android:id="@+id/navigation"
              android:layout_width="0dp"
              android:layout_height="wrap_content"
              android:layout_marginEnd="0dp"
              android:layout_marginStart="0dp"
              android:background="?android:attr/windowBackground"
              app:layout_constraintBottom_toBottomOf="parent"
              app:layout_constraintLeft_toLeftOf="parent"
              app:layout_constraintRight_toRightOf="parent"
              app:menu="@menu/navigation_menu"/&gt;
  
  
  
  &lt;/android.support.constraint.ConstraintLayout&gt;
  </code></pre>
  
  <p>I want the <code>TextView</code> on top, followed by the <code>CardView</code>, followed by a <code>ConstraintLayout</code>, followed by the <code>bottomNavigationView</code>. Somehow the elements are stacked on top of each other like this:</p>
  
  <p><a href="https://i.stack.imgur.com/ETFSA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ETFSA.png" alt="PhoneEmulator"></a></p>
  
  <p>I made sure that every element are constrained to the top or bottom of the next element respectively. Still they end up on top of each other. Is there a better way or a fix to this problem?</p>