ImageView in Android UI controls

ImageView is one of the UI Widgets that is used to display images in our Android Application. ImageView comes with different configuration options to support different scale types. Scale types options are used for scaling the bounds/boundary of an image to the bounds/boundary of current view.

below are the listed scale type configuration property of current view:

1) center
2) centerCrop
3) centerInside
4) fitCenter
5) fitEnd
6) fitStart
7) fitXY
8) matrix

imageview

.xml file:

java file:

package com.example.imageview;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.Toast;

public class MainActivity extends Activity
{
ImageView _objimageView;

@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

//setting image resource from drawable
_objimageView = (ImageView) findViewById(R.id.imageView2);

}

}

Skip to toolbar