An ImageView is simply a view you embed within an XML layout that is used to display an image (or any drawable) on the screen. The ImageView looks like this in res/layout/activity_main.xml:
<ImageView
android:id=”@+id/image”
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:scaleType=”center”
android:src=”@drawable/my_image” />
The ImageView handles all the loading and scaling of the image for you. The scaleType attribute which defines how the images will be scaled to fit in your layout.
Comments
Post a Comment