Created
August 25, 2018 23:28
-
-
Save RamiJ3mli/50421bd2b45b497831cc872a6dd37fcb to your computer and use it in GitHub Desktop.
Relative percentage based dimensions
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
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent"> | |
<Button | |
android:id="@+id/button" | |
android:layout_width="180dp" | |
android:layout_height="wrap_content" | |
android:background="@drawable/bg" | |
android:text="Button" | |
app:layout_constraintBottom_toBottomOf="parent" | |
app:layout_constraintLeft_toLeftOf="parent" | |
app:layout_constraintRight_toRightOf="parent" | |
app:layout_constraintTop_toTopOf="parent" /> | |
<Space | |
android:id="@+id/anchor" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:visibility="gone" | |
app:layout_constraintHorizontal_bias=".7" | |
app:layout_constraintLeft_toLeftOf="@+id/button" | |
app:layout_constraintRight_toRightOf="@+id/button" /> | |
<Button | |
android:id="@+id/another_button" | |
android:layout_width="0dp" | |
android:layout_height="wrap_content" | |
android:layout_marginTop="16dp" | |
android:background="@drawable/bg_red" | |
app:layout_constraintLeft_toLeftOf="@+id/button" | |
app:layout_constraintRight_toRightOf="@+id/anchor" | |
app:layout_constraintTop_toBottomOf="@+id/button" /> | |
</android.support.constraint.ConstraintLayout> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment