Search code examples
android-jetpackcomposable

Jetpack Compose - How can add multiple modifier to a composable and is the order important?


I wanted to know how we can add multiple modifier, for example adding background, padding and more to an android jetpack composable?


Solution

  • It's really simple; You can chain multiple modifiers.

    Column(modifier = Modifier.preferredHeight(500.dp).padding(100.dp)) {
    Text("Hello")  }
    

    And The order is important; Modifier elements to the left are applied before modifier elements to the right.