Skip to main content

ImageView

declare class ImageView extends View {}

Displays image resources, for example Bitmap or Drawable resources.

Attribute

adjustViewBounds

<ImageView adjustViewBounds="true"></ImageView>
  • Description

    Set this to true if you want the ImageView to adjust its bounds to preserve the aspect ratio of its drawable.

baseline

<ImageView baseline="1"></ImageView>
  • Description

    The offset of the baseline within this view.

src

<ImageView src="http://xxxxxx"></ImageView>
<ImageView src="@drawable/drawable_id"></ImageView>
  • Description

    Sets a drawable as the content of this ImageView.
    Supports HTTP remote addresses.

baselineAlignBottom

<ImageView baselineAlignBottom="false"></ImageView>
  • Description

    If true, the image view will be baseline aligned with based on its bottom edge.

maxHeight

<ImageView maxHeight="10px"></ImageView>
  • Description

    An optional argument to supply a maximum height for this view.

maxWidth

<ImageView maxWidth="10px"></ImageView>
  • Description

    An optional argument to supply a maximum width for this view.

scaleType

<ImageView scaleType="center"></ImageView>
  • Description

    Controls how the image should be resized or moved to match the size of this ImageView.

`matrix` `fitXY` `center` `centerCrop` `centerInside` `fitCenter` `fitEnd` `fitStart`

cropToPadding

<ImageView cropToPadding="true"></ImageView>
  • Description

    If true, the image will be cropped to fit within its padding.