11

I am trying to disable the DrawerLayout shadow and i am not finding the relevant answer. can anyone please assist

thanks in advance

i have also tried setDrawerLayout(null,Gravity.Left) but it still does not work

upile
  • 113
  • 1
  • 5

3 Answers3

42
mDrawerLayout.setScrimColor(Color.TRANSPARENT);

I'm Assuming that's what you mean. The shadow on the drawers (in between the drawer and the background content) is disabled by default and can be set with the

setDrawerShadow(Drawable shadowDrawable, int gravity)
setDrawerShadow(int resId, int gravity)

functions.

Christopher Gertz
  • 1,826
  • 1
  • 15
  • 9
1

To enable):

mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START)

To disable:

mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.END)

NOTE: For those who needs perfect drawer shadow, go to link-below and put shadows to your project directory files respectively:

https://developer.android.com/shareables/training/NavigationDrawer.zip

Farid
  • 2,317
  • 1
  • 20
  • 34
1

To disable the drawer layout shadow, the following line is enough ,

mDrawerLayout.setScrimColor(Color.TRANSPARENT);

Nanda Gopal
  • 2,519
  • 1
  • 17
  • 25