3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ImageView Center Scale types review

Last updated at Posted at 2016-05-18

Prepare

  • Source 1 (1600 x 1200):
  • Source 2 (480 x 360):

  • Layout:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#3e3639"
    >

  <ImageView
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:layout_gravity="center"
      android:layout_margin="16dp"
      android:background="#ea5444"
      android:cropToPadding="false"
      android:padding="16dp"
      android:adjustViewBounds="false"
      android:scaleType="center"
      android:src="@drawable/io16_social"
      />

</FrameLayout>

Reviews

A. SDK 23, Source 1.

I. layout_width="match_parent"
  • 1 ScaleType = center
layout_height="match_parent", adjustViewBounds="false" layout_height="match_parent", adjustViewBounds="true" layout_height="wrap_content", adjustViewBounds="false" layout_height="wrap_content", adjustViewBounds="true"
  • 2 ScaleType = centerCrop
layout_height="match_parent", adjustViewBounds="false" layout_height="match_parent", adjustViewBounds="true" layout_height="wrap_content", adjustViewBounds="false" layout_height="wrap_content", adjustViewBounds="true"
  • 3 ScaleType = centerInside
layout_height="match_parent", adjustViewBounds="false" layout_height="match_parent", adjustViewBounds="true" layout_height="wrap_content", adjustViewBounds="false" layout_height="wrap_content", adjustViewBounds="true"
  • 4 ScaleType = fitCenter
layout_height="match_parent", adjustViewBounds="false" layout_height="match_parent", adjustViewBounds="true" layout_height="wrap_content", adjustViewBounds="false" layout_height="wrap_content", adjustViewBounds="true"
II. layout_width="wrap_content"
  • 1 ScaleType = center
layout_height="match_parent", adjustViewBounds="false" layout_height="match_parent", adjustViewBounds="true" layout_height="wrap_content", adjustViewBounds="false" layout_height="wrap_content", adjustViewBounds="true"
  • 2 ScaleType = centerCrop
layout_height="match_parent", adjustViewBounds="false" layout_height="match_parent", adjustViewBounds="true" layout_height="wrap_content", adjustViewBounds="false" layout_height="wrap_content", adjustViewBounds="true"
  • 3 ScaleType = centerInside
layout_height="match_parent", adjustViewBounds="false" layout_height="match_parent", adjustViewBounds="true" layout_height="wrap_content", adjustViewBounds="false" layout_height="wrap_content", adjustViewBounds="true"
  • 4 ScaleType = fitCenter
layout_height="match_parent", adjustViewBounds="false" layout_height="match_parent", adjustViewBounds="true" layout_height="wrap_content", adjustViewBounds="false" layout_height="wrap_content", adjustViewBounds="true"

B. SDK 23, Source 2.

I. layout_width="match_parent"
  • 1 ScaleType = center
layout_height="match_parent", adjustViewBounds="false" layout_height="match_parent", adjustViewBounds="true" layout_height="wrap_content", adjustViewBounds="false" layout_height="wrap_content", adjustViewBounds="true"
  • 2 ScaleType = centerCrop
layout_height="match_parent", adjustViewBounds="false" layout_height="match_parent", adjustViewBounds="true" layout_height="wrap_content", adjustViewBounds="false" layout_height="wrap_content", adjustViewBounds="true"
  • 3 ScaleType = centerInside
layout_height="match_parent", adjustViewBounds="false" layout_height="match_parent", adjustViewBounds="true" layout_height="wrap_content", adjustViewBounds="false" layout_height="wrap_content", adjustViewBounds="true"
  • 4 ScaleType = fitCenter
layout_height="match_parent", adjustViewBounds="false" layout_height="match_parent", adjustViewBounds="true" layout_height="wrap_content", adjustViewBounds="false" layout_height="wrap_content", adjustViewBounds="true"
II. layout_width="wrap_content"
  • 1 ScaleType = center
layout_height="match_parent", adjustViewBounds="false" layout_height="match_parent", adjustViewBounds="true" layout_height="wrap_content", adjustViewBounds="false" layout_height="wrap_content", adjustViewBounds="true"
  • 2 ScaleType = centerCrop
layout_height="match_parent", adjustViewBounds="false" layout_height="match_parent", adjustViewBounds="true" layout_height="wrap_content", adjustViewBounds="false" layout_height="wrap_content", adjustViewBounds="true"
  • 3 ScaleType = centerInside
layout_height="match_parent", adjustViewBounds="false" layout_height="match_parent", adjustViewBounds="true" layout_height="wrap_content", adjustViewBounds="false" layout_height="wrap_content", adjustViewBounds="true"
  • 4 ScaleType = fitCenter
layout_height="match_parent", adjustViewBounds="false" layout_height="match_parent", adjustViewBounds="true" layout_height="wrap_content", adjustViewBounds="false" layout_height="wrap_content", adjustViewBounds="true"
3
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?