像 Medium 那样在 Android device 上优雅地加载图片

3,530 阅读1分钟

BlurImageView For Android, you can load your image progressively like Medium.

How it works?

  1. First it will show user a blurry image;
  2. At the same time, it starts to load the real image;
  3. once loaded, replace the blurry one automatically.

Why I do this?

This lib is inspired by Medium and users love this way of loading pics, Because a beautiful Blurry pic is always better than a blank area or an ugly thumbnail.

How to use it?

    BlurImageView blurImageView = (BlurImageView) findViewById(R.id.XXX);
    blurImageView.setBlurImageByUrl(blurImageUrl);

This will load and blur a image.

  BlurImageView fullBlurImageView = (BlurImageView) findViewById(R.id.XXX)
  fullBlurImageView.setFullImageByUrl(blurImageUrl, normalImageUrl);

This will load two images progressively.

  blurImageView.setBlurFactor(blurFactor);

This can set the factor of blurry, default 8 - 10.

Related resource

Thanks for the algorithms: Stack Blur: www.quasimondo.com/StackBlurFo…

Reach me

You can get information about me and reach me in my github page: github.com/wingjay

Feel free to give me advices by yinjiesh@126.com

Thanks!