Disable dark fading in Navigation Drawer

后端 未结 4 711
天命终不由人
天命终不由人 2020-12-24 00:38

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

相关标签:
4条回答
  • 2020-12-24 01:13

    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

    0 讨论(0)
  • 2020-12-24 01:13

    You can set a custom shadow:

    mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);
    
    0 讨论(0)
  • 2020-12-24 01:32

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

    mDrawerLayout.setScrimColor(Color.TRANSPARENT);
    
    0 讨论(0)
  • 2020-12-24 01:34

    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));
    
    0 讨论(0)
提交回复
热议问题