How to disable DrawerLayout Shadow

十年热恋 提交于 2019-11-30 01:56:54

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!