Skip to content

Android Compose Add a Scrollable List #245

Description

@D2hugging

Name of the Codelab or Codelab URL

Add a scrollable list (basic-android-kotlin-compose-training-add-scrollable-list)
https://developer.android.com/codelabs/basic-android-kotlin-compose-training-add-scrollable-list

Describe the problem

In the AffirmationsApp() code snippet, the Surface composable's modifier argument is written with an uppercase parameter name:

Surface(
    Modifier = Modifier
        .fillMaxSize()
        ...
)

This does not compile. Surface has no parameter named "Modifier"; its parameter is the lowercase "modifier". The correct code should use the lowercase parameter name: "modifier = Modifier.fillMaxSize()...".

In which lesson and step of the codelab can this issue be found?

Step 3, "Add a list to your app" — the AffirmationsApp() composable snippet that wraps AffirmationsList in a Surface.

How to reproduce?

  1. Open the codelab and go to step 3, "Add a list to your app".
  2. Copy the AffirmationsApp() code snippet exactly as shown on the page.
  3. Paste it into MainActivity.kt in Android Studio.
  4. Build the project. It fails with the compile error: "No parameter with name 'Modifier' found.".
  5. Changing the uppercase "Modifier =" to the lowercase "modifier =" resolves the error.

Versions

  1. What version of Android Studio are you using?

  2. What API level are you targeting?

  3. Android Studio: Android Studio Otter | 2025.2.1 Patch 1

  4. API level targeted: compileSdk 36 / targetSdk 36

Additional information

The intended snippet is:

modifier = Modifier
    .fillMaxSize()
    .statusBarsPadding()
    .padding(...)

Here the lowercase "modifier" is the Surface parameter name. Only the casing of the parameter name is wrong in the published snippet.

codelab: basic-android-kotlin-compose-training-add-scrollable-list

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions