I create an bitmap image from byte array and display it in an ImageView. The android:layout_width
and android:layout_height
of the ImageView are set to wrap_content, and the android:scaleType
is set to center. But the image is still scaled to the screen size.
Is there a way to display the image at its original size (just like using the android:src attribute directly)?
CODE:
create bitmap from byte array:
private Bitmap decodeBitmap(byte[] data) {
return BitmapFactory.decodeByteArray(data, 0, data.length);
}
and layout of the ImageView:
<ImageView
android:id="@+id/logo"
android:scaleType="centerInside"
android:adjustViewBounds="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
set image to ImageView:
mView.setImageBitmap(mBitmap);