Building the Scene

The first step is to build the scene that will be animated. Create a new project called Sunset. Make sure that your minimum API level is set to 24.

Before setting up anything else, open the app/build.gradle file. As in other apps, you are going to use View Binding to help you out in Sunset.

Listing 25.1  Setting up View Binding (app/build.gradle)

    ...
    android {
        ...
        kotlinOptions {
            jvmTarget = '1.8'
        }
        buildFeatures {
            viewBinding true
        }
    }

Do not forget to sync your changes with Gradle.

A sunset by the sea should be colorful, so it will help to start by naming a few colors. Open the colors.xml file in your res/values folder and add the following values to it.

Listing 25.2  Adding sunset colors (res/values/colors.xml ...

Get Android Programming: The Big Nerd Ranch Guide, 5th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.