Skip to content

Instantly share code, notes, and snippets.

@mr-thierry
Last active May 4, 2018 13:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mr-thierry/13c3ce8097e963a404d4a2e703336d0b to your computer and use it in GitHub Desktop.
Save mr-thierry/13c3ce8097e963a404d4a2e703336d0b to your computer and use it in GitHub Desktop.
Using layout_constraintDimensionRatio breaks the alignment
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/green">
<ImageView
android:layout_width="0dp"
android:layout_height="0dp"
android:src="@drawable/photofullscreen_sample"
app:layout_constrainedWidth="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintDimensionRatio="1200:900"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintWidth_max="120dp" />
</android.support.constraint.ConstraintLayout>
@mr-thierry
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment