Java – the background of the drawerlayout is dimmed

I want to know how to darken the drawer background when the drawer is open. I have a transparent drawer menu (listview). When the drawer is open, for example, I also have a list view under a menu, and the two list views overlap. Android has a default screen darkened, but I want it to be darker

Android uses this format: color.dkgray

to update:

public void setScrimColor (int color)
Set a color to use for the scrim that obscures primary content while a drawer is open.

Parameters
color   Color to use in 0xAARRGGBB format.


mDrawerLayout.setDrawerShadow(new ColorDrawable(0xff00DDED), GravityCompat.START);
or
mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);

resolvent:

You can use the setscrimcolor (int color) method. The default color is 0x99000000. If you want to use the color specified in the resource, you can call:

Setscrimcolor (getresources(). Getcolor (r.color. Some_color))

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>