WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

ScaleType ImageView Android


It have many properties of scaletype for ImageView in Android are FIT_CENTER, FIT_END, FIT_START, FIT_XY,ENTER, CENTER_CROP, CENTER_INSIDE, and MATRIX.


ImageView ScaleTypes

FIT CENTER fit center is a scale type used in android to scale the image from center.
<ImageView
android:id="@+id/simpleImageView"
android:layout_width="fill_parent"
android:layout_height="300dp"
android:scaleType="fitCenter"
android:src="@drawable/ICON" />

set up in java class

ImageView simpleImageView=(ImageView)findViewById(R.id.simpleImageView);
simpleImageView.setScaleType(ImageView.ScaleType.FIT_CENTER);

FIT_ENDfit end scale type is used in android to fit the image or source file to the end of the container

<ImageView
android:id="@+id/simpleImageView"
android:layout_width="fill_parent"
android:layout_height="250dp"
android:scaleType="fitEnd"
android:src="@drawable/icon" />
set up in java class
ImageView simpleImageView=(ImageView)findViewById(R.id.demoImageView);
simpleImageView.setScaleType(ImageView.ScaleType.FIT_END);

FIT_START Fit start is used to scale the image from start of the container.
<ImageView
android:id="@+id/simpleImageView"
android:layout_width="fill_parent"
android:layout_height="220dp"
android:scaleType="setStart"
android:src="@drawable/icon" />

set up java class
ImageView simpleImageView=(ImageView)findViewById(R.id.demoImageView);
simpleImageView.setScaleType(ImageView.ScaleType.FIT_START);

FIT_XY: fit_XY scale type is used in Android to scale the image using fill
<ImageView
android:id="@+id/simpleImageView"
android:layout_width="fill_parent"
android:layout_height="210dp"
android:scaleType="fitXY"
android:src="@drawable/icon" />

ImageView simpleImageView=(ImageView)findViewById(R.id.demoImageView);
simpleImageView.setScaleType(ImageView.ScaleType.FIT_XY);

MATRIX matrix is a scale type used in android to scale using the image matrix when drawing.
<ImageView
android:id="@+id/simpleImageView"
android:layout_width="fill_parent"
android:layout_height="220dp"
android:scaleType="matrix"
android:src="@drawable/icon" />
srring up java class
ImageView simpleImageView=(ImageView) findViewById(R.id.demoImageView);
simpleImageView.setScaleType(ImageView.ScaleType.MATRIX);
CENTER this is used in android to center the image to the ImageView but does not scale the image.
<ImageView
android:id="@+id/demoImageView"
android:layout_width="fill_parent"
android:layout_height="250dp"
android:scaleType="center"
android:src="@drawable/icon" />
set up in java class
ImageView simpleImageView=(ImageView)findViewById(R.id.demoImageView);
simpleImageView.setScaleType(ImageView.ScaleType.CENTER);
CENTER_INSIDE it is used in android to center the image inside the container.
<ImageView
android:id="@+id/demoImageView"
android:layout_width="fill_parent"
android:layout_height="280dp"
android:scaleType="centerInside"
android:src="@drawable/icon" />
set up in java class

ImageView simpleImageView=(ImageView)findViewById(R.id.demoImageView);
simpleImageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);