Android Blur View (Blur background behind the view)

后端 未结 4 603
暖寄归人
暖寄归人 2020-12-24 15:10

I am trying to make the bottom part of an Image blur for the view on top it like in the image.

I tried blurring it using Rendenscript but I am not able to blur only

4条回答
  •  甜味超标
    2020-12-24 16:00

    This can be achieved in following steps:

    • Extract the background image of LinearLayout by cropping background Image. Now extend LinearLayout Class.

    • Override OnDraw(Canvas mCanvas) method.

    • Create two methods in your Custom LinearLayout Class:

      1. DrawBitmap
      2. DrawColor.
    • First call the DrawBitmap function by giving the offset you got from ViewPager to background image so that image moves when the use swipe the screen.

    • Finally draw the color with your transparency level

    I hope this will solve your problem.

    Sample Code for this

    How to Blur a View

提交回复
热议问题