Android的平局与模糊 [英] Android draw with blur

查看:132
本文介绍了Android的平局与模糊的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要用模糊效果在Android上的帆布做画, 这是一个非常简单的功能, 我需要绘制一个圆形区域,这是模糊(前景)和背景透明的,我可以做一切与操纵彩色字母与定制的透明度,做到这一点,但我需要它被模糊,而不是透明的.. 任何想法?

I need do draw on Android's Canvas using Blur effect, it is a very simple feature, I need to draw a circular area, which is blurred (the foreground) and the background transparent, I can do everything with manipulating the colour alpha to do it with custom transparency but I need it to be blurred instead of transparent.. any ideas?

推荐答案

(对于那些谁回来了,尽管这是一个老问题)

(For those who are coming back, though this is an old question)

在您使用绘制颜色,油漆对象设置

On the Paint object which you are using to draw the Color, set

paint.setMaskFilter(new BlurMaskFilter(8, BlurMaskFilter.Blur.NORMAL))

那么,在Android中的Manifest.xml,设置

Then, in Android Manifest.xml, set

android:hardwareAccelerated="false"

为您的活动 (当硬件加速是真实的模糊不工作)

for your activity (Blur doesn't work when hardware acceleration is true)

有关详细说明,请参阅 <一href="http://stackoverflow.com/questions/11281404/android-blurmaskfilter-has-no-effect-in-canvas-drawoval-while-text-is-blurred">Android BlurMaskFilter在canvas.drawOval没有效果,而文字是模糊

For more explanation refer Android BlurMaskFilter has no effect in canvas.drawOval while text is blurred

这篇关于Android的平局与模糊的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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