I have a dialog fragment which contains the RecyclerView. For my initial overall constraint layout none of the above solutions worked, so I changed it to a linear layout, which works without problems. This layout contains a toolbar and the recyclerview.