How to blur background images in Android

前端 未结 10 2144
借酒劲吻你
借酒劲吻你 2020-11-30 22:12

What is the best way to blur background images like the image below? I saw some code and libraries but their are a couple of years old or like BlurBehind library, but it doe

10条回答
  •  醉酒成梦
    2020-11-30 22:53

    this might not be the most efficient solution but I had to use it since the wasabeef/Blurry library didn't work for me. this could be handy if you intend to have some getting-blurry animation:

    1- you need to have 2 versions of the picture, normal one and the blurry one u make with photoshop or whatever

    2- set the images fit on each other in your xml, then one of them could be seen and that's the upper one

    3- set fadeout animation on the upper one:

    final Animation fadeOut = new AlphaAnimation(1, 0);
            fadeOut.setInterpolator(new AccelerateInterpolator());
            fadeOut.setDuration(1000);
    
    
            fadeOut.setAnimationListener(new Animation.AnimationListener() {
                @Override
                public void onAnimationStart(Animation animation) {}
    
                @Override
                public void onAnimationEnd(Animation animation) {upperone.setVisibility(View.GONE);}
    
                @Override
                public void onAnimationRepeat(Animation animation) {}
            });
    
            upperone.startAnimation(fadeOut);
    

提交回复
热议问题