For example, refers to a scale type in which the image is centered in the ImageView. The options for ScaleType are defined in ImageView.ScaleType. Using ScaleType, you can have an image fill the entire ImageView, be centered in the ImageView, or be cropped and centered in the ImageView. The ScaleType defines how the image will be displayed within the ImageView. In this hour, you populate an ImageView using a resource id as the source and then explore several properties of how an ImageView can display an image. To populate a Drawable object from a resource, use the getResources.getDrawable() method: Drawable myDrawable = getResources().getDrawable(R.drawable.ic_launcher) To set an ImageView to an image resource defined by R.drawable.mainImage, you use the following: ImageView mainImage = (ImageView) findViewById(R.id.imageView1)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |