修复聊天室添加粉丝徽章,bitmap被回收的问题

This commit is contained in:
zlzw 2022-12-14 13:57:46 +08:00
parent 4a8c29365c
commit 98940d7554

View File

@ -322,6 +322,9 @@ public class LiveTextRender {
tv.setText(bean.getMedalNmae());
tv.setTypeface(Typeface.DEFAULT_BOLD);
Bitmap bitmap = convertViewToBitmap(view);
if (bitmap == null) {
return null;
}
Drawable drawable = new BitmapDrawable(bitmap);
return drawable;
}
@ -330,10 +333,15 @@ public class LiveTextRender {
view.measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED), MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
view.layout(0, 0, view.getMeasuredWidth(), view.getMeasuredWidth() / 3);
// 153 72
view.buildDrawingCache();
Bitmap bitmap = view.getDrawingCache();
try {
view.buildDrawingCache();
Bitmap bitmap = view.getDrawingCache();
return bitmap;
return bitmap;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
public void render(final Context context, final TextView textView, final LiveChatBean bean) {