【问题标题】:How can I create a Modal BottomSheet with blur background instead of the default gray translucent one如何创建具有模糊背景而不是默认的灰色半透明背景的模态 BottomSheet
【发布时间】:2017-08-22 07:06:16
【问题描述】:

我正在使用模态底页,如何将默认的灰色半透明背景更改为模糊背景,就像我们在 iOS 中看到的那样

【问题讨论】:

  • 在BottomSheet中,我们必须使用带有recyclerview等视图的布局。我们可以将背景颜色设置为父布局。

标签: android android-layout material-design bottom-sheet


【解决方案1】:

您可以使用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.

【讨论】:

  • 在哪里使用这个方法?在底页代码中?
猜你喜欢
  • 1970-01-01
  • 2015-11-05
  • 2013-09-28
  • 2012-06-25
  • 2019-01-05
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多