constraintDimensionRatio code example

Example: constraintDimensionRatio

<?xml version="1.0" encoding="utf-8"?><android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_width="match_parent"    android:layout_height="match_parent"    xmlns:app="http://schemas.android.com/apk/res-auto">    <ImageView        android:layout_width="wrap_content"        android:layout_height="0dp"        android:src="@drawable/top_image"        app:layout_constraintDimensionRatio="16:9"        app:layout_constraintTop_toTopOf="parent"        app:layout_constraintStart_toStartOf="parent"        app:layout_constraintEnd_toEndOf="parent"/></android.support.constraint.ConstraintLayout>

Tags:

Misc Example