6. This work is licensed under the Apache 2.0 License
Android Studio Steps to Install
First App
7. This work is licensed under the Apache 2.0 License
8. This work is licensed under the Apache 2.0 License
The onCreate() function is the entry point to
this app and calls other functions to build the
user interface. In Kotlin programs, the main()
function is the specific place in your code
where the Kotlin compiler starts. In Android
apps, the onCreate() function fills that role.
onCreate() function
9. This work is licensed under the Apache 2.0 License
The setContent() function within the
onCreate() function is used to define your
layout through composable functions. All
functions marked with the @Composable
annotation can be called from the
setContent() function or from other
Composable functions. The annotation tells
the Kotlin compiler that this function is used
by Jetpack Compose to generate the UI
setContent()
10. This work is licensed under the Apache 2.0 License
The scalable pixels (SP) is a unit of measure for
the font size. UI elements in Android apps use
two different units of measurement: density-
independent pixels (DP), which you use later
for the layout, and scalable pixels (SP). By
default, the SP unit is the same size as the DP
unit, but it resizes based on the user's
preferred text size under phone settings.
Units
11. This work is licensed under the Apache 2.0 License
sp (Scaleable Pixels OR scale-independent
pixels) — this is like the dp unit, but it is also
scaled by the user’s font size preference. It is
recommended you use this unit when
specifying font sizes, so they will be adjusted
for both the screen density and user’s
preference. Note, the Android documentation is
inconsistent on what sp actually stands for, one
doc says “scale-independent pixels”, the other
says “scaleable pixels”.
12. This work is licensed under the Apache 2.0 License
To create a new project: Open Android Studio, click New Project >
Empty Compose Activity > Next, enter a name for your project and then
configure its settings.
To see how your app looks, use the Preview pane.
Composable functions are like regular functions with a few differences:
functions names are capitalized, you add the @Composable annotation
before the function, @Composable functions can't return anything.
A Modifier is used to augment or decorate your composable.
Summary of First App
13. This work is licensed under the Apache 2.0 License
Follow Along
GreetingCard App
14. This work is licensed under the Apache 2.0 License
THANK YOU!