Issue #396

Use app:headerLayout

<com.google.android.material.navigation.NavigationView
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:id="@+id/navigationView"
    android:fitsSystemWindows="true"
    android:layout_gravity="start"
    app:menu="@menu/drawer_menu"
    app:itemIconTint="@color/title"
    app:itemTextColor="@color/title"
    app:headerLayout="@layout/navigation_header" />

navigation_header.xml

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto">
    <androidx.appcompat.widget.AppCompatImageView
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:src="@drawable/icon"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintBottom_toBottomOf="parent"/>

</androidx.constraintlayout.widget.ConstraintLayout>