From the course: Intermediate Kotlin for Android Developers
Unlock the full course today
Join today to access over 22,400 courses taught by industry experts or purchase this course individually.
Anko layouts: Basics
From the course: Intermediate Kotlin for Android Developers
Anko layouts: Basics
- [Instructor] In order to work successfully with Anko layouts, you need to understand its use of the AnkoContext and Anko components. First, you can think of the AnkoContext as the container for all of your Android goodies. It's an interface that holds a reference to the context, which is needed to create views programmatically, the owner of the created views, and the view itself. Notice that it also implements another interface, the ViewManager. The ViewManager contains a few methods for working with views, the most important of which is the addView method. This takes in a view you want to add, and then the LayoutParams, which describe how this view should be positioned in its parent. And that's it for the AnkoContext. Next up is the Anko component. This is where we define what views we want to have created. This can be anything, from an entire screen's layout to just a simple component. And these views are defined using Anko's DSL. DSL, as a refresher, stands for Domain-Specific…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
Anko overview3m 33s
-
Anko commons: Basics4m 12s
-
Anko commons: Design and support.v43m 55s
-
Anko layouts: Basics3m 1s
-
Anko layouts: Create a custom component6m 2s
-
Anko layouts: Style component views4m 18s
-
Anko layouts: Use a custom component4m 16s
-
Anko layouts: Listeners4m 28s
-
Anko layouts: Anko Support plugin1m 54s
-
-
-
-