Android draw with blur

Tancho picture Tancho · Dec 30, 2009 · Viewed 21.6k times · Source

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?

Answer

user2903200 picture user2903200 · Feb 9, 2014

(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))

Then, in Android Manifest.xml, set

android:hardwareAccelerated="false"

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

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