+-

Like this image 我正在尝试将通知大图标设置为用户个人资料缩略图
如whatsapp或其他聊天应用
如whatsapp或其他聊天应用
我努力了
Glide.with(context)
.asBitmap()
.load(messageNotification.getLargeIcon())
.into(new SimpleTarget<Bitmap>() {
@Override
public void onResourceReady(Bitmap resource, Transition<? super Bitmap> transition) {
builder.setLargeIcon(resource);
}
});
但它不起作用..
有帮助吗?
最佳答案
如果使用glide ..设置大图标,则还应该通知NotificationManager onResourceReady(资源,过渡)
.into(new SimpleTarget<Bitmap>() {
@Override
public void onResourceReady(Bitmap res, Transition<? super Bitmap> t) {
builder.setLargeIcon(res);
yourNotificationManager.notify(id, builder.build());
}
});
This is because glide uses background thread to load image..so before your image is loaded into builder… the notification manager is already notified (mainthread) with builder not having large image..
点击查看更多相关文章
转载注明原文:android-如何在NotificationCompat.Builder.setLargeIcon()中加载Glide缓存的图像? - 乐贴网