问题
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
回答1:
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.
回答2:
To disable the drawer layout shadow, the following line is enough ,
mDrawerLayout.setScrimColor(Color.TRANSPARENT);
回答3:
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
来源:https://stackoverflow.com/questions/19009662/how-to-disable-drawerlayout-shadow