Good morning. I have a layout like this:
<android.support.v4.widget.DrawerLayout
<android.support.design.widget.CoordinatorLayout
...
</android.support.design.widget.CoordinatorLayout>
<android.support.design.widget.NavigationView
android:id="@+id/main_drawer"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
app:itemTextColor="@color/jet"
android:fitsSystemWindows="true"
app:headerLayout="@layout/drawer_header"
app:menu="@menu/action_menu" />
<ListView
android:id="@+id/navList"
android:layout_width="200dp"
android:layout_height="match_parent"
android:layout_gravity="left|start"
android:background="@color/chalk" />
</android.support.v4.widget.DrawerLayout>
And then, on my Activity I populate the ListView like this:
String[] osArray = {"CERRAR SESIÓN", "ACERCA DE"};
arrayAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, osArray);
listView.setAdapter(arrayAdapter);
My issue is that the layout I'm using as a header for the drawer, overlaps the ListView. I have tried also giving the ListView a marginTop, but although that works in Android Studio (apparently), it solves nothing when running the code.
Just in case, here is the layout I use as a header for the drawer:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="@dimen/header_height"
android:background="@color/accent"
android:gravity="bottom"
android:orientation="vertical"
android:padding="@dimen/header_left_padding"
android:theme="@style/ThemeOverlay.AppCompat.Dark">
<TextView
android:id="@+id/username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/user_name"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:textStyle="bold" />
<TextView
android:id="@+id/email"
style="@style/Widget.AppCompat.Spinner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/user_email"
android:textAppearance="@style/TextAppearance.AppCompat.Body1" />
</LinearLayout>
Any help will be appreciated, thank you.