From the course: Intermediate Kotlin for Android Developers

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Anko layouts: Style component views

Anko layouts: Style component views

From the course: Intermediate Kotlin for Android Developers

Start my 1-month free trial

Anko layouts: Style component views

- When working with layouts in XML you could set the styling on each individual element or create a style to be reused across them. NCO allows you to do something similar. We want to be able to support the styles and layout decisions that we've made already. For instance, here's our text view that contains the planet's composition. We've already set a style for it we specified the type of heading that we would like as well as that the text is selectable. In using NCO, we want to be able to support the same exact things. So let's move over to our NCO component and add in these styles. So we're going to move to the planet detail UI class. And here's our first text view that has the compound drawable. So let's start by supplying our padding. And if you recall the padding was equal to 16 dips so we're going to use the VIP function. We also had padding around the compound drawable and it was exactly the same compound drawable padding. It was also 16. And then we had that the text was…

Contents