修复聊天室添加粉丝徽章,bitmap被回收的问题
This commit is contained in:
parent
4a8c29365c
commit
98940d7554
@ -322,6 +322,9 @@ public class LiveTextRender {
|
|||||||
tv.setText(bean.getMedalNmae());
|
tv.setText(bean.getMedalNmae());
|
||||||
tv.setTypeface(Typeface.DEFAULT_BOLD);
|
tv.setTypeface(Typeface.DEFAULT_BOLD);
|
||||||
Bitmap bitmap = convertViewToBitmap(view);
|
Bitmap bitmap = convertViewToBitmap(view);
|
||||||
|
if (bitmap == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
Drawable drawable = new BitmapDrawable(bitmap);
|
Drawable drawable = new BitmapDrawable(bitmap);
|
||||||
return drawable;
|
return drawable;
|
||||||
}
|
}
|
||||||
@ -330,10 +333,15 @@ public class LiveTextRender {
|
|||||||
view.measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED), MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
|
view.measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED), MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
|
||||||
view.layout(0, 0, view.getMeasuredWidth(), view.getMeasuredWidth() / 3);
|
view.layout(0, 0, view.getMeasuredWidth(), view.getMeasuredWidth() / 3);
|
||||||
// 153 72
|
// 153 72
|
||||||
|
try {
|
||||||
view.buildDrawingCache();
|
view.buildDrawingCache();
|
||||||
Bitmap bitmap = view.getDrawingCache();
|
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) {
|
public void render(final Context context, final TextView textView, final LiveChatBean bean) {
|
||||||
|
Loading…
Reference in New Issue
Block a user