I would like to have the same result for the header of the navigation drawer as in this picture :
Actually, the xml code of my nav header (which I add in the MainActivity using navigationView.addHeaderView(navHeader); ) is the following :
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimary"
android:orientation="horizontal"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:theme="@style/ThemeOverlay.AppCompat.Dark">
<ImageView
android:id="@+id/loginView"
android:layout_width="50dp"
android:layout_height="50dp"
android:gravity="center"
android:paddingTop="@dimen/nav_header_vertical_spacing"
android:src="@android:drawable/ic_menu_camera" />
<TextView
android:id="@+id/loginName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingTop="@dimen/nav_header_vertical_spacing"
android:text="SE CONNECTER"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:textSize="16sp" />
</LinearLayout>
And I get that as result:
Sorry for the french in the screenshot ;)