【发布时间】:2015-10-15 00:48:29
【问题描述】:
我写了一些代码可以将表格布局转换为位图。everythink 工作完美但是,我的位图有黑色背景 这是我的源代码
public Bitmap sendMyData(TableLayout view) {
Bitmap bitmap = null;
ByteArrayOutputStream bbb = new ByteArrayOutputStream();
view.setDrawingCacheEnabled(true);
view.layout(0, 0, view.getWidth(), view.getHeight());
view.buildDrawingCache(true);
bitmap = Bitmap.createBitmap(view.getDrawingCache());
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, bbb);
view.setDrawingCacheEnabled(false);
return bitmap;
}
我的代码有什么问题?为什么我的位图有黑色背景? 如果有人知道解决方案,请帮助我 谢谢
【问题讨论】:
-
下面的链接可以帮助你stackoverflow.com/questions/5536066/…
-
尝试使用 Bitmap.CompressFormat.PNG
-
@AMD , .PNG 不工作,仍然是黑色背景
标签: android android-layout android-canvas android-bitmap