我从远程数据库中获取了一个Base64字符串的位图,(encodedImage是用Base64表示图像的字符串):
profileImage = (ImageView)findViewById(R.id.profileImage);
byte[] imageAsBytes=null;
try {
imageAsBytes = Base64.decode(encodedImage.getBytes());
} catch (IOException e) {e.printStackTrace();}
profileImage.setImageBitmap(
BitmapFactory.decodeByteArray(imageAsBytes, 0, imageAsBytes.length)
);
Run Code Online (Sandbox Code Playgroud)
profileImage是我的ImageView
好的,但是我必须在显示我ImageView的布局之前调整此图像的大小.我必须将其调整为120x120.
有人能告诉我调整大小的代码吗?
我找到的示例无法应用于获得位图的base64字符串.