如何在android中模糊视图或布局?

The*_*heQ 5 android blur android-layout android-xml material-design

我试图模糊一个视图或布局,就像我下面的例子.到目前为止,我只看到了模糊图像的例子,我对如何在布局上实现模糊感到困惑.我希望你们能帮忙!

在此输入图像描述

干杯!

Mav*_*eňツ 6

试试这个库,它很好用,简单易用.

建立

依赖

dependencies {
compile 'jp.wasabeef:blurry:2.0.3'
}
Run Code Online (Sandbox Code Playgroud)

功能

覆盖

父必须是ViewGroup

Blurry.with(context).radius(25).sampling(2).onto((ViewGroup) rootView);
Run Code Online (Sandbox Code Playgroud)

Blurry.with(context).capture(view).into(imageView);
Run Code Online (Sandbox Code Playgroud)

模糊选项

  • 半径
  • 下采样
  • 彩色滤光片
  • 异步支持
  • 动画(仅覆盖)

Blurry.with(context)
.radius(10)
.sampling(8)
.color(Color.argb(66, 255, 255, 0))
.async()
.animate(500)
.onto(rootView);
Run Code Online (Sandbox Code Playgroud)

输出:

在此输入图像描述