Created
March 30, 2018 14:16
-
-
Save turastory/45d84400f50e457f0da142315b4b4a39 to your computer and use it in GitHub Desktop.
Flexible Layout with ConstraintLayout
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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" | |
xmlns:tools="http://schemas.android.com/tools"> | |
<LinearLayout | |
android:id="@+id/image_container" | |
android:layout_width="wrap_content" | |
android:layout_height="0dp" | |
android:layout_marginTop="11dp" | |
android:gravity="center" | |
android:orientation="vertical" | |
android:paddingBottom="25dp" | |
android:paddingLeft="15dp" | |
android:paddingRight="15dp" | |
android:paddingTop="15dp" | |
app:layout_constraintTop_toTopOf="parent" | |
app:layout_constraintBottom_toBottomOf="parent" | |
app:layout_constraintLeft_toLeftOf="parent"> | |
<android.support.constraint.ConstraintLayout | |
android:id="@+id/image_1_container" | |
android:layout_width="match_parent" | |
android:layout_height="0dp" | |
android:layout_weight="1"> | |
<ImageView | |
android:id="@+id/image_1" | |
android:layout_width="0dp" | |
android:layout_height="0dp" | |
android:layout_margin="4dp" | |
tools:src="@mipmap/ic_launcher_round" | |
app:layout_constraintBottom_toBottomOf="parent" | |
app:layout_constraintDimensionRatio="1,1" | |
app:layout_constraintLeft_toLeftOf="parent" | |
app:layout_constraintRight_toRightOf="parent" | |
app:layout_constraintTop_toTopOf="parent"/> | |
<View | |
android:id="@+id/image_1_touch_area" | |
android:layout_width="0dp" | |
android:layout_height="0dp" | |
app:layout_constraintBottom_toBottomOf="parent" | |
app:layout_constraintLeft_toLeftOf="parent" | |
app:layout_constraintRight_toRightOf="parent" | |
app:layout_constraintTop_toTopOf="parent"/> | |
</android.support.constraint.ConstraintLayout> | |
<android.support.constraint.ConstraintLayout | |
android:id="@+id/image_2_container" | |
android:layout_width="match_parent" | |
android:layout_height="0dp" | |
android:layout_marginTop="10dp" | |
android:layout_weight="1"> | |
<ImageView | |
android:id="@+id/image_2" | |
android:layout_width="0dp" | |
android:layout_height="0dp" | |
android:layout_margin="4dp" | |
tools:src="@mipmap/ic_launcher_round" | |
app:layout_constraintBottom_toBottomOf="parent" | |
app:layout_constraintDimensionRatio="1,1" | |
app:layout_constraintLeft_toLeftOf="parent" | |
app:layout_constraintRight_toRightOf="parent" | |
app:layout_constraintTop_toTopOf="parent"/> | |
<View | |
android:id="@+id/image_2_touch_area" | |
android:layout_width="0dp" | |
android:layout_height="0dp" | |
app:layout_constraintBottom_toBottomOf="parent" | |
app:layout_constraintLeft_toLeftOf="parent" | |
app:layout_constraintRight_toRightOf="parent" | |
app:layout_constraintTop_toTopOf="parent"/> | |
</android.support.constraint.ConstraintLayout> | |
<android.support.constraint.ConstraintLayout | |
android:id="@+id/image_3_container" | |
android:layout_width="match_parent" | |
android:layout_height="0dp" | |
android:layout_marginTop="10dp" | |
android:layout_weight="1"> | |
<ImageView | |
android:id="@+id/image_3" | |
android:layout_width="0dp" | |
android:layout_height="0dp" | |
android:layout_margin="4dp" | |
tools:src="@mipmap/ic_launcher_round" | |
app:layout_constraintBottom_toBottomOf="parent" | |
app:layout_constraintDimensionRatio="1,1" | |
app:layout_constraintLeft_toLeftOf="parent" | |
app:layout_constraintRight_toRightOf="parent" | |
app:layout_constraintTop_toTopOf="parent"/> | |
<View | |
android:id="@+id/image_3_touch_area" | |
android:layout_width="0dp" | |
android:layout_height="0dp" | |
app:layout_constraintBottom_toBottomOf="parent" | |
app:layout_constraintLeft_toLeftOf="parent" | |
app:layout_constraintRight_toRightOf="parent" | |
app:layout_constraintTop_toTopOf="parent"/> | |
</android.support.constraint.ConstraintLayout> | |
<android.support.constraint.ConstraintLayout | |
android:id="@+id/image_4_container" | |
android:layout_width="match_parent" | |
android:layout_height="0dp" | |
android:layout_marginTop="10dp" | |
android:layout_weight="1"> | |
<ImageView | |
android:id="@+id/image_4" | |
android:layout_width="0dp" | |
android:layout_height="0dp" | |
android:layout_margin="4dp" | |
tools:src="@mipmap/ic_launcher_round" | |
app:layout_constraintBottom_toBottomOf="parent" | |
app:layout_constraintDimensionRatio="1,1" | |
app:layout_constraintLeft_toLeftOf="parent" | |
app:layout_constraintRight_toRightOf="parent" | |
app:layout_constraintTop_toTopOf="parent"/> | |
<View | |
android:id="@+id/image_4_touch_area" | |
android:layout_width="0dp" | |
android:layout_height="0dp" | |
app:layout_constraintBottom_toBottomOf="parent" | |
app:layout_constraintLeft_toLeftOf="parent" | |
app:layout_constraintRight_toRightOf="parent" | |
app:layout_constraintTop_toTopOf="parent"/> | |
</android.support.constraint.ConstraintLayout> | |
</LinearLayout> | |
</android.support.constraint.ConstraintLayout> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment