Skip to content

Android: Navigation Drawer vertical shadow

I have implemented a NavigationDrawer in my application. I would like to know how I can add a vertical shadow effect which is below the main Fragment, similar to the picture below.

enter image description here

I have one image on my drawable with the shadow image. It’s called “drawer_shadow.9” but I don’t know how I can implement this inside my NavigationDrawer.



You will need to use a drawable for the shadow. Use the setDrawerShadow method on the navigationDrawer object. For example:

navigationDrawer.setDrawerShadow(R.drawable.someDrawable, GravityCompat.START);

Link to the official document: setDrawerShadow

Hope this helps

User contributions licensed under: CC BY-SA
5 People found this is helpful