I would like to blur the background of the content pane when the DrawerLayout is open. I noticed that there is the ability to change the dim color by setting setScrimColor but I would like to blur the background. Is there a way to achieve this?
The process involves the following stages:
Get a snapshot of the whole drawer layout.
Crop it to the exact size of your menu.
Downscale it quite a bit (a factor of 8 is pretty good).
Blur that image.
Have a custom view that displays part of an image right behind of where your menu will appear.
Please refer this answer
Blur background of Navigation Drawer
Or you can use one of these libraries
Check out this library: Blurry . it takes a View
or a Bitmap
, blurs it and casts it to a ViewGroup
or an ImageView
. So just run Blurry.with(context).capture(parentView).into(parentView);
whenever the drawer is opened. Where parentView
is the container that holds everything.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.