What I did was change the /layout/fragment_crime_list.xml
It turns out that if a FrameLayout has multiple children, those children will be drawn on top of one another.
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout 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">
<!-- Layer 1 -->
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/crime_recycler_view"/>
<!-- Layer 2 -->
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/empty_list_layout">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/empty_list_text"
android:layout_marginTop="16dp"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginEnd="16dp"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginStart="16dp"
app:layout_constraintLeft_toLeftOf="parent" />
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:id="@+id/add_crime_button"
android:text="@string/new_crime"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginBottom="16dp"
android:layout_marginEnd="16dp"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginStart="16dp"
app:layout_constraintLeft_toLeftOf="parent" />
</android.support.constraint.ConstraintLayout>
</FrameLayout>
I put an ID on the ConstraintLayout because I’ll be able to set its visibility to View.INVISIBLE when the list is not empty. The child Views will inherit this visibility change.
Now all of the changes you need to make are in CrimeListFragment.java