开发者

ImageView padding above and below image

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜