Disable dark fading in Navigation Drawer

2019-01-21 21:45发布

Is there a way to disable the dark fading effect for the background view in the Navigation Drawer View in Android?

4条回答
神经病院院长
2楼-- · 2019-01-21 22:08

Addition to koso's answer: you can directly call the colors from Color class like this:

mDrawerLayout.setScrimColor(Color.TRANSPARENT);
查看更多
Deceive 欺骗
3楼-- · 2019-01-21 22:22

You can use setScrimColor(int color) method. As default color is used 0x99000000. So if you don't want faded background, set transparent color in this method.

mDrawerLayout.setScrimColor(getResources().getColor(android.R.color.transparent));
查看更多
闹够了就滚
4楼-- · 2019-01-21 22:25

You can set a custom shadow:

mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);
查看更多
祖国的老花朵
5楼-- · 2019-01-21 22:31

drawerLayout.setScrimColor(Color.parseColor("#99000000"));

// For dark fading effect

                            or

drawerLayout.setScrimColor(Color.parseColor("#33000000"));

// For light fading effect

                            or

drawerLayout.setScrimColor(Color.TRANSPARENT);

// For no Fading

查看更多
登录 后发表回答