Skip to content

Instantly share code, notes, and snippets.

@redleafar
Created September 8, 2016 04:32
Show Gist options
  • Save redleafar/8c181a102c7d3ce8bb19223042f6a3d7 to your computer and use it in GitHub Desktop.
Save redleafar/8c181a102c7d3ce8bb19223042f6a3d7 to your computer and use it in GitHub Desktop.
How to set a background image in navigator view

Just add: android:background="@drawable/image" (in this case fondo_menu):

<android.support.design.widget.NavigationView
        android:id="@+id/nav_view"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:fitsSystemWindows="true"
        android:background="@drawable/fondo_menu"
        app:itemTextColor="#ffffff"
        app:headerLayout="@layout/nav_header_principal"
        app:menu="@menu/activity_principal_drawer"
        android:theme="@style/AppTheme"
        android:layout_marginLeft="50dp"/>

Take in account that Android Studio, oddly, doesn't suggest for this line the drawable directory, neither its content, so you can think mistakenly this is not the way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment