How do I make android imageview square?
android, imageview
Solution
The best way for square image is use ConstraintLayout with constraintDimensionRatio Without give fix height/width.
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/image"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintDimensionRatio="H,1:1"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>
Problem
I'm using an `ImageView` in an Android project. Width: `match_parent` Height: `wrap_content` then I scale it to `fill_XY`, but the image is not square yet... what can I do?