Reputation: 19679
I am trying to set the image of an ImageView from a byte array like this:
Bitmap bitmap = BitmapFactory.decodeByteArray(imageData, 0, imageData.length);
ImageView imageView = (ImageView)findViewById(R.id.imageView);
imageView.setImageBitmap(bitmap);
But the image appears to have some quite large black padding at the top and the bottom, even though the actual image data does not have these. The ImageView is at the top of a LinearLayout inside a ScrollView, any ideas?
My ImageView is designed like this:
<ImageView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageView"/>
Upvotes: 2
Views: 1015
Reputation: 19679
Solved, I added
android:adjustViewBounds="true"
Into the XML file.
Upvotes: 4