| | |
| | | * @param imageview 显示图片组件 |
| | | * @param roundedCorners 设置图片角度值 |
| | | */ |
| | | public static void getRoundedCornersImage(Context context, String url, ImageView imageview, RoundedCorners roundedCorners) { |
| | | if (!(url.startsWith("http://") || url.startsWith("https://"))) { |
| | | imageview.setImageDrawable(AppCompatResources.getDrawable(context, R.drawable.plant_default_picture)); |
| | | return; |
| | | } |
| | | // if (url.startsWith("http://") || url.startsWith("https://")) { |
| | | Glide.with(context) |
| | | .load(url) |
| | | .apply(new RequestOptions() |
| | | .placeholder(R.drawable.plant_default_picture) |
| | | .error(R.drawable.plant_default_picture) |
| | | .fallback(R.drawable.plant_default_picture)) |
| | | .transform(new CenterCrop(), roundedCorners)//Glide加载图片圆角效果与ImageView的ScaleType冲突问题 |
| | | // .transform(roundedCorners) |
| | | .into(imageview); |
| | | // } else { |
| | | // setDefaultImage(context, imageview, userImage); |
| | | // } |
| | | } |
| | | |
| | | /** |
| | | * 图片四个角统一指定 |
| | | * |
| | | * @param context 上下文 |
| | | * @param url 图片地址 |
| | | * @param imageview 显示图片组件 |
| | | * @param roundedCorners 设置图片角度值 |
| | | */ |
| | | public static void getRoundedCornersImage(Context context, String url, ImageView imageview, RoundedCorners roundedCorners, boolean userImage) { |
| | | if (!(url.startsWith("http://") || url.startsWith("https://"))) { |
| | | setDefaultImage(context, imageview, userImage); |