English (United States) subtitles

← Simple ImageView - Solution

Get Embed Code
14 Languages

Showing Revision 1 created 09/28/2016 by Udacity Robot.

  1. If we try the smaller image,
  2. then we see that the image is actually
    smaller than the size of the screen.
  3. So it doesn't matter if we choose scaleType
    to be center or centerCrop.
  4. The full image will be able
    to be shown in the view.
  5. And this is what it looks
    like with a photograph.
  6. Now let's try the icon.
  7. That was called Android.
  8. So the size of the icon is smaller
    than the size of the screen so
  9. if we do wrap_content for the width and
    height then it should fit on the screen.
  10. It doesn't matter if we use center or
    centerCrop.
  11. Now what happens if we set the image
    view to be larger than the device size?
  12. Say we pick a really large
    number like 900dp and width and
  13. height, then the image you will take
    up a size larger than the screen size.
  14. But the scaleType is set to center.
  15. So, the icon will be centered
    within that humongous image view.
  16. If we choose centerCrop though,
  17. the system tries to scale the image
    up to be a square of 900dp by 900dp.
  18. And then it centers and crops the image.
  19. Now that you've experimented
    with the imageView xml,
  20. hopefully you have a better idea of
    how to display images in your app.