您的位置:首页 > 其它

头像处理-高斯模糊

2017-08-16 11:29 197 查看
实现步骤如下:

a. 在Android Studio项目build.gradle中添加Dependencies

    //git地址:https://github.com/wasabeef/Blurry

    compile 'jp.wasabeef:blurry:2.1.1'

b.  布局文件

              <ImageView

                    android:id="@+id/iv_me_header_big"

                    android:layout_width="match_parent"

                    android:layout_height="match_parent"

                    android:scaleType="centerCrop"

                    />

c. 代码中调用

                //高斯模糊头像

                Glide.with(getActivity()).load(userInfo.getHeadurl()).asBitmap().fitCenter().into(new SimpleTarget<Bitmap>() {

                    @Override

                    public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) {

                        Blurry.with(getActivity()).from(resource).into(mIvHeaderBig);

                    }

                });

最后附上效果图(是针对用户头像进行的模糊,然后设置为用户信息页的背景):

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: