Skip to content

Instantly share code, notes, and snippets.

@vamsigp
Last active April 30, 2019 04:18
Show Gist options
  • Save vamsigp/784be59f8ae1e2137ece1349c726d1f8 to your computer and use it in GitHub Desktop.
Save vamsigp/784be59f8ae1e2137ece1349c726d1f8 to your computer and use it in GitHub Desktop.
Chaining Constraint Layout
<androidx.constraintlayout.widget.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="wrap_content">
<Button
android:id="@+id/hide1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:tag="hide1"
android:text="Hide"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@+id/btn_comment1"
app:layout_constraintTop_toBottomOf="@+id/container1"/>
<Button
android:id="@+id/btn_comment1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:tag="btn_comment1"
android:text="Comment"
app:layout_constraintLeft_toRightOf="@+id/hide1"
app:layout_constraintRight_toLeftOf="@+id/share1"
app:layout_constraintTop_toTopOf="@+id/hide1"/>
<Button
android:id="@+id/share1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:tag="share1"
android:text="Share"
app:layout_constraintLeft_toRightOf="@+id/btn_comment1"
app:layout_constraintRight_toRightOf="@+id/share2"
app:layout_constraintTop_toTopOf="@+id/btn_comment1"/>
<Button
android:id="@+id/share2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:tag="share1"
android:text="Share2"
app:layout_constraintLeft_toRightOf="@+id/share1"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@+id/btn_comment1"/>
</androidx.constraintlayout.widget.ConstraintLayout>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment