Set ImageView adjustViewBounds to true

Description

The following code shows how to Set ImageView adjustViewBounds to true.

Example


<?xml version="1.0" encoding="utf-8"?>
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/icon"
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"
    android:adjustViewBounds="true"
    android:src="@drawable/myImageFileName"
    />//w  w  w .  j av  a2s  .com

Java code.


import android.app.Activity;
import android.os.Bundle;
/*from   w w w. j  a v  a2  s.c o  m*/
public class ImageViewDemo extends Activity {
  @Override
  public void onCreate(Bundle icicle) {
      super.onCreate(icicle);
      setContentView(R.layout.main);
  }
}




















Home »
  Android »
    Android UI »




UI Basics
Action Bar
Animation
Button
Canvas
CheckBox
Clock Date Picker
Dialog
EditText
Event
Fragment
Gesture
GridView
ImageView
Layout
ListView
Map
Menu
Model
OpenGL
ProgressBar
RadioButton
Spinner
Tab
TextView
Thread
Toast
Video
View
WebView