Instruction

Heads up... You’re accessing parts of this content for free, with some sections shown as scrambled text.

Heads up... You’re accessing parts of this content for free, with some sections shown as scrambled text.

Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.

Unlock now

Exploring Built-in Components

Before looking at how you can clean up the GitHub repo app using components, it’s a good practice to explore some of the foundational components that Jetpack Compose ships with.

Exploring the Image Component

You can use the Image component to display a graphic on your screen. To load an image from the disk (JPEG, PNG or WEBP), use the painterResource by passing the image reference as a parameter.

Displaying Vector Images

VectorDrawables is the standard API used when you want to display a vector asset in your app. These vectors are usually icons.

Exploring Buttons

You’ve already covered buttons a few times in the previous lessons, but it’s time you covered all the different types of buttons compose offers and where you should use them.

Filled Button

A filled button is the basic Button component that you’ve used so far. It’s filled with a solid color by default. Following is a simple example of a filled button:

Filled Tonal Button

A filled tonal button is filled with a tonal color based on the material design spec by default. The following snippet shows an example of the FilledTonalButton component:

Elevated Button

An elevated button has a shadow that represents the elevation effect by default. It’s an outlined button with a default shadow. Here’s an example of how the ElevatedButton component is used:

Outlined Button

An outlined button has no color fill but comes with an outline by default. Here’s an example of the same:

Text Button

Finally, the text button component appears only as text. By default, it has no fill, outline or elevation. However, it still has the necessary interaction indicators to differentiate it from a text component with a clickable modifier.

Exploring the Switch Component

The Switch component allows users to toggle between a checked and unchecked state. You can use the switch to let users:

See forum comments
Download course materials from Github
Previous: Introduction Next: Demo