问题描述
如何才能影响像?
在一个应用程序(适用于iOS )我可以看到它是真实的,所以我想这样做在我的 Android版应用。
这是任何图书馆或其他什么东西?
In one app (for iOS) i can see that it's real, so i want to do it in my Android app.Is it any library or something else?
推荐答案
不像iOS8上,Android不具备一个内置的模糊效果,但也有可用于创建您自己的效果的几种方法。
Unlike iOS8, Android does not have a built-in blurring effect, but there are several approaches that can be used to create your own effect.
如果你想模糊,可以渲染到位图视图
,那么一个好的解决办法是使用 RenderScript
ScriptIntrinsicBlur
。一个有用的开源 BlurringView
,它利用 ScriptIntrinsicBlur
已被500px的开发,是缴费的。这种观点背后的想法是,你叫 .setBlurredView(查看视图)
与视图
是下面的观点 BlurringView
是模糊。然后,调用 .invalidate()
每当模糊是被重绘,因为鉴于模糊变了。
If you want to blur a view that can be rendered to a Bitmap
, then a good solution would be to use the RenderScript
ScriptIntrinsicBlur
. A useful open source BlurringView
that utilizes the ScriptIntrinsicBlur
has been developed by 500px and is avaiable here. The idea behind this view is that you call .setBlurredView(View view)
, with view
being the view below the BlurringView
that is to be blurred. Then, call .invalidate()
whenever the blur is to be redrawn since the view to blur changed.
然而,检索位图
直接掀起了表面
,因为它是一个观点是不可能的。如果你想模糊的表面,而不是一个看法,我建议采取看看。
However, retrieving a Bitmap
directly off a Surface
is not possible as it is with a view. If you want to blur a surface rather than a view, I recommend taking a look at this answer.
这篇关于滚动模糊效果为Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!