Android的,如何模糊/玻璃/霜当前活动 [英] Android, how to blur/glass/frost current activity

查看:110
本文介绍了Android的,如何模糊/玻璃/霜当前活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基本上

在一个活动,我有一个ListView。 当我选择一个项目,一个透明的活动打开一个小盒子。 当此对话框出现时,您仍然可以查看previous活动画面,

In an activity, I have a ListView. When I select an item, an transparent activity opens as a small box. When this box appears, you can still view the previous activities screen,

我试图找出是如何模糊喜欢的previous屏幕 图像链接这里(忽略用户界面,只是看模糊草区)。

What I am trying to figure out is how to blur the previous screen like the image linked here (Ignore the UI, just look at the blurred grass area).

这怎么可能?

感谢您提出的任何建议。

Thank you for any advice.

推荐答案

有关API< 14,你可以使用该标志 WindowManager.LayoutParams.FLAG_BLUR_BEHIND ,但它一直pcated和内置模糊德$ P $不再较高的API支持

For API < 14, you could use the flag WindowManager.LayoutParams.FLAG_BLUR_BEHIND, but it's been deprecated and built-in blurring is no longer supported on higher APIs

不过,你可以用一个普通视图或覆盖做到这一点。你要做的是:

However, you could do this with a regular view or overlay. What you want to do is:

  • 创建一个位图从活动的整体布局(在这里看到,例如
  • 模糊,任何你想要的位图(几个例子这里
  • 添加(或取消)一个查看在布局,涵盖一切。设置BKG以模糊位图
  • 打开的对话​​框/透明活性
  • 当它关闭,或者删除查看 setVisibility(GONE)如果你使用它试。
  • Create a Bitmap from your activity's overall layout (see here for example)
  • Blur that bitmap with whatever method you want(a few examples here)
  • Add(or unhide) a View in your layout that covers everything. Set bkg to blurred Bitmap
  • Open your dialog/transparent activity
  • When it closes, either remove the View, or setVisibility(GONE) if you'll be using it again.

这篇关于Android的,如何模糊/玻璃/霜当前活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆