【发布时间】:2019-01-30 18:27:31
【问题描述】:
我试图在图像视图中显示 base64 图像,但它不显示。我正在解码和设置图像视图的图像位图。 我正在动态添加图像视图。问题是因为我动态添加图像吗? 下面是代码sn-p:
LayoutInflater inflaterDocuments = (LayoutInflater)GetSystemService(Context.LayoutInflaterService);
View inflatedHeaderLayout = inflaterDocuments.Inflate(Resource.Layout.imageListItem, null, false);
ImageView imageView = inflatedHeaderLayout.FindViewById<ImageView>(Resource.Id.imageView);
byte[] decodedString = Base64.Decode(base64String, Base64Flags.Default);
Bitmap bitMap = BitmapFactory.DecodeByteArray(decodedString, 0, decodedString.Length);
imageView.SetImageBitmap(bitMap);
imageView.Invalidate();
_imageLayout.AddView(inflatedHeaderLayout);
编辑
Base64 字符串文件Base64.txt
【问题讨论】:
-
是否有任何解决方案适合您?
标签: android xamarin.android imageview base64