Skip to content

Calculate a custom tip: Android Basics with Compose #348

Description

@Lazyaair

URL of codelab
Calculate a custom tip
In which task and step of the codelab can this issue be found?
[Calculate a custom tip]--->[Add a switch]--->[8th code box]

Describe the problem
The switch statement uses a modifier from a higher-level component, causing the "verticalAlignment" field of the row component to malfunction. Specifically, the switch component appears in an unexpected position instead of being vertically centered.

Steps to reproduce?

  Switch(
      modifier = modifier
          .fillMaxWidth()
          .wrapContentWidth(Alignment.End),
      checked = roundUp,
      onCheckedChange = onRoundUpChanged,
  )

Versions
Android Studio version: 2025.1.3.7
API version of the emulator: API 36.1

Additional information
just use modifier = Modifier
Image
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions