title: Using ListView inside ConstraintLayout
body: <p>I have read on <a href="https://developer.android.com/training/constraint-layout/index.html" rel="nofollow noreferrer">Android Developers</a> that ConstraintLayout can be used to design a responsive layout for an application. There is a parent ConstraintLayout which houses a toolbar and two other ConstraintLayouts. The first child ConstraintLayout is going to act as empty view for my ListView. The second ConstraintLayout holds my listview and a floating action button. Currently, the the listview appears under the Toolbar, rather than below it. Also as seen in the screenshot, the floating action button appears outside visible area.<br>
  See the screenshot below:<br>
  <a href="https://i.stack.imgur.com/p5Wh3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/p5Wh3.png" alt="enter image description here"></a>      </p>
  
  <p>And this is the app layout when the list is empty:<br>
  <a href="https://i.stack.imgur.com/SSsCS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SSsCS.png" alt="enter image description here"></a> </p>
  
  <p>This is the code for my layout:    </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"
      android:id="@+id/content"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:orientation="vertical"
      &gt;
  
      &lt;android.support.v7.widget.Toolbar xmlns:app="http://schemas.android.com/apk/res-auto"
          android:id="@+id/toolbar"
          android:layout_width="match_parent"
          android:layout_height="?attr/actionBarSize"
          android:background="?attr/colorPrimary"
          android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
          app:layout_constraintTop_toTopOf="parent"
          app:layout_constraintRight_toRightOf="parent"/&gt;
  
  
      &lt;android.support.constraint.ConstraintLayout
          app:layout_constraintTop_toBottomOf="@id/toolbar"
          android:id="@+id/empty_view"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_marginTop="?attr/actionBarSize"&gt;
  
          &lt;TextView
              app:layout_constraintTop_toTopOf="parent"
              android:id="@+id/tv_empty_view"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:text="@string/list_is_empty"
              android:textSize="@dimen/large_text"
              android:textStyle="bold"
              /&gt;
  
          &lt;ImageView
              android:id="@+id/iv_empty_view"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              app:layout_constraintTop_toBottomOf="@id/tv_empty_view"
              app:layout_constraintLeft_toLeftOf="parent"
              app:layout_constraintRight_toRightOf="parent"
              android:contentDescription="@string/list_is_empty"
              android:src="@drawable/emptybox" /&gt;
      &lt;/android.support.constraint.ConstraintLayout&gt;
      &lt;android.support.constraint.ConstraintLayout
          android:id="@+id/main_area"
          android:layout_marginTop="50dp"
          android:layout_marginBottom="?actionBarSize"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          app:layout_constraintTop_toBottomOf="@id/toolbar"
          app:layout_constraintBottom_toBottomOf="parent"&gt;
  
      &lt;ListView
          android:id="@+id/listview"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_marginBottom="?attr/actionBarSize"
          android:layout_marginLeft="@dimen/margin_side"
          android:layout_marginStart="@dimen/margin_side"
          android:layout_marginRight="@dimen/margin_side"
          android:layout_marginEnd="@dimen/margin_side"
          android:layout_marginTop="?attr/actionBarSize"
          /&gt;
      &lt;android.support.design.widget.FloatingActionButton
          android:layout_below="@+id/listview"
          android:id="@+id/fab"
          android:layout_width="@android:dimen/notification_large_icon_width"
          android:layout_height="@android:dimen/notification_large_icon_height"
          android:layout_gravity="end|bottom"
          android:src="@drawable/plus"
          app:layout_constraintBottom_toBottomOf="parent"
          app:layout_constraintRight_toRightOf="parent"
          /&gt;
      &lt;/android.support.constraint.ConstraintLayout&gt;
  
  
  
  &lt;/android.support.constraint.ConstraintLayout&gt;
  </code></pre>