Learning Android Development

Android Matrix ScaleType Explained

Making a custom scaling transformation on Android Image

Image by Comfreak on Pixabay

Understanding Android Image ScaleTypes is essential for any Android Developer. The basic ones are all explained below, except for Matrix

In a normal situation, there’s no need of using Matrix ScaleType. Nonetheless, for something more interesting as below, we will need Matrix ScaleType.

Using Matrix ScaleType with Scaling, Skewing, Translating

The Matrix ScaleType

To set up a matrix scale type, it is just as simple as below.

<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/image_picture"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/lion"
android:scaleType="matrix" />

--

--