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开发者_如何学Python 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"/>
Solved, I added
android:adjustViewBounds="true"
Into the XML file.
精彩评论