This library adds ConstraintLayout DSL in Anko library. It is based on the 1.1.0-beta4
version of the library.
Usage(wiki)
ConstraintLayout is defined and added to other ViewGroups in the same way as any other view in Anko:
anyViewGroupLayout {
constraintLayout {
val button1 = button {
id = View.generateViewId()
text = "1"
}
val button2 = button {
id = View.generateViewId()
text = "2"
}
constraints({
// view horizontal constraints definitions
button1 - dip(30) % button2
alignTail(button1, button2)
}, {
// view vertical constraints definitions
parent - button1 - parent
})
}
}
dependencies {
compile 'com.github.seisuke:akmk:0.3.0'
}
repositories {
maven { url 'http://raw.github.com/seisuke/akmk/release/repository/' }
}
- Placeholders
- Dimension DSL
- Percent Dimensions