Android draw with blur

前端 未结 3 2142
清歌不尽
清歌不尽 2020-12-28 23:20

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 tr

3条回答
  •  死守一世寂寞
    2020-12-28 23:55

    (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

提交回复
热议问题