Skip to content

Instantly share code, notes, and snippets.

@victorbrndls
Created October 19, 2021 12:18
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 victorbrndls/168868fe2607f2b314f6e153d32af80c to your computer and use it in GitHub Desktop.
Save victorbrndls/168868fe2607f2b314f6e153d32af80c to your computer and use it in GitHub Desktop.
ConstraintLayout {
val (button, text) = createRefs()
Button(
modifier = Modifier.constrainAs(button) {
top.linkTo(parent.top, margin = 16.dp)
}
)
Text("Text", Modifier.constrainAs(text) {
top.linkTo(button.bottom, margin = 16.dp)
})
}
ConstraintSet {
val button = createRefFor("button")
val text = createRefFor("text")
constrain(button) { ... }
constrain(text) { ... }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment