Introduction to Views DSL
mainSplitties Views DSL allows you to create Android UIs using readable Kotlin code instead of XML. It is designed as a collection of extension functions and properties rather than a new class hierarchy, making it easy to discover and use within existing Android projects.
Key characteristics:
- Interoperability: Seamlessly works with existing
android.view.Viewobjects and XML layouts. - Stability: The API is stable and built on the foundation of the standard Android View API.
- Simplicity: You don't need to learn a new framework; you simply use extension functions to configure views.
Example of creating a button:
val launchDemoBtn = button {
textResource = R.string.go_to_the_demo
}