Aspect Ratio ImageView

A simple imageview which scales the width or height aspect with the given ratio.

Sample

Usage

Gradle

allprojects {
  repositories {
    maven { url 'https://jitpack.io' }
  }
}
dependencies {
  implementation 'com.github.santalu:aspect-ratio-imageview:1.0.5'
}

XML

<com.santalu.widget.AspectRatioImageView
    android:layout_width="200dp"
    android:layout_height="0dp"
    android:scaleType="centerCrop"
    android:src="@drawable/sample"
    app:ari_ratio="1.2"/>

GitHub