package com.example.a51044.apa1.utils;
import android.content.Context;
import android.widget.ImageView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.bumptech.glide.request.RequestOptions;
public class GlideUtil {
//默认加载
public static void loadImageView(Context mContext, String path, ImageView mImageView) {
Glide.with(mContext).load(path).into(mImageView);
}
//圆角加载
public static void CircularImageView(Context mContext, Object path, ImageView mImageView) {
//设置图片圆角角度
RoundedCorners roundedCorners= new RoundedCorners(10);
//通过RequestOptions扩展功能,override:采样率,因为ImageView就这么大,可以压缩图片,降低内存消耗
RequestOptions options=RequestOptions.bitmapTransform(roundedCorners).override(300, 300);
Glide.with(mContext).load(path).apply(options).into(mImageView);
}
//圆形加载
public static void RoundImageView(Context mContext, String path, ImageView mImageView) {
//设置图片圆角角度
RoundedCorners roundedCorners= new RoundedCorners(200);
//通过RequestOptions扩展功]能,override:采样率,因为ImageView就这么大,可以压缩图片,降低内存消耗
RequestOptions options=RequestOptions.bitmapTransform(roundedCorners).override(300, 300);
Glide.with(mContext).load(path).apply(options).into(mImageView);
}
}