Writing UI in XML is not type safe or null safe, and it also eats CPU and battery. Writing UI programmatically (especially in Java) becomes bulky and unmanageable for large and complex UIs. That is when Anko layouts come to the rescue. We can easily create layouts in DSL using Anko layouts, and it also has no runtime overhead. In this recipe, we will see how to create layouts using DSL.
Creating user-interface programmatically
Getting ready
I'll be using Android Studio 3 to write code. You can get started by creating a new project in Kotlin with a blank activity in Android Studio 3+, as we won't be using any code from other recipes. You also need an intermediate understanding of Android development. Ensure that you...