【发布时间】:2014-03-21 09:27:40
【问题描述】:
这是我在.NET 上使用的方法来创建发送到android App 的字符串,图像是System.Drawing.Image 在Bitmap 中输入转换:
Public Shared Function SerializeObject(ByVal objeto As Bitmap) As String
Dim bitmapBytes As Byte()
Dim stream As New System.IO.MemoryStream
objeto.Save(stream, System.Drawing.Imaging.ImageFormat.Bmp)
bitmapBytes = stream.ToArray
stream.Flush()
stream.Dispose()
Dim str1 = Convert.ToBase64String(bitmapBytes)
Return str1
End Function
这是创建图像的android方法:
public static Bitmap GetObjectBitmap(String str) {
Bitmap bm;
try {
byte [] encodeByte=Base64.decode(str.trim(), Base64.DEFAULT);
bm = BitmapFactory.decodeByteArray(encodeByte, 0, encodeByte.length);
} catch(Exception e) {
e.getMessage();
bm = null;
}
return bm;
}
问题是图片在ImageView中显示,背景是黑色而不是透明。
【问题讨论】:
-
我不知道 bmp 格式有透明度...
标签: android .net png transparency