The following code shows how to
Set ImageView
adjustViewBounds
to true.
<?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" />
Java code.
import android.app.Activity; import android.os.Bundle; // w ww . ja va2 s . co m public class ImageViewDemo extends Activity { @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main); } }