【发布时间】:2017-08-22 07:06:16
【问题描述】:
我正在使用模态底页,如何将默认的灰色半透明背景更改为模糊背景,就像我们在 iOS 中看到的那样
【问题讨论】:
-
在BottomSheet中,我们必须使用带有recyclerview等视图的布局。我们可以将背景颜色设置为父布局。
标签: android android-layout material-design bottom-sheet
我正在使用模态底页,如何将默认的灰色半透明背景更改为模糊背景,就像我们在 iOS 中看到的那样
【问题讨论】:
标签: android android-layout material-design bottom-sheet
您可以使用this 库。它具有自定义模糊效果的选项,例如颜色、半径、采样等。
将此添加到您的应用级别 gradle compile 'jp.wasabeef:blurry:2.1.1'
实现也很简单参考这段代码。
Blurry.with(context)
//style the blur with your color and effects with radius and sampling
.radius(10)
.sampling(8)
.color(Color.argb(66, 255, 255, 0))
.animate(500) //optional
//always use ViewGroup instance, avoid casting other view to viewgroup, it wont work
.onto(rootView); //Use your bottom sheet layout's rootview here.
【讨论】: