0

Here is my image view:

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/imageView3"
        android:layout_above="@+id/progressBar"
        android:layout_alignParentRight="true"
        android:layout_alignParentEnd="true"
        android:maxWidth="120dp"
        android:maxHeight="100dp"
        android:scaleType="fitCenter" />

But when I set an image to it like this:

        final ImageView iv = (ImageView)findViewById(R.id.imageView3);
        iv.setImageBitmap(docPicture);

... it fills the screen width. It seems to ignore the MaxWidth and MaxHeight - what am I doing wrong and why is the imageview allowed to exceed its max size?

Edit:
Solved by simply adding the ambiguous android:adjustViewBounds="true"
Annoyingly I had tried this but set to false - "true" seemed to me to be the problem - that it was adjust the boundaries I had set!!

noelicus
  • 14,468
  • 3
  • 92
  • 111

0 Answers0