Android Programming: The Big Nerd Ranch Guide, 5th Edition
by Bryan Sills, Brian Gardner, Kristin Marsicano, Chris Stewart
Customizing Composables
Coda Pizza is off to a great start. You are ready to start making your composables look just the way you want them to. Previously, you accomplished this using XML attributes. In Compose, function parameters take the place of the attributes that you are accustomed to in XML.
You have already seen a few parameters on the built-in composables you have been using: text for the Text composable and checked and onCheckedChange for Checkbox. You are also free to add parameters to your own composables.
Declaring inputs on a composable function
Think about the ToppingCell composable. It will need to take in three pieces of information: the name of the topping, the placement of the topping, and what to do when ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access