Home > Mobile >  Passing argument 1f to fillMaxSize() - Purpose?
Passing argument 1f to fillMaxSize() - Purpose?

Time:01-08

I have seen this in another person's code:

@Composable
fun UsingFraction() {
Column(modifier = Modifier
    .fillMaxSize(1f)
    .background(Color(0xff888888))) {
    Text(text = "Testing, fraction 123 ...")
}

}

What's the purpose of the fraction-argument "1f" in this specific case?

I know, that it is for distributing available space. But I could find no difference, when I had it in or when I removed it. Concerning the shown snippet.

CodePudding user response:

Default parameter for fillMaxSize() is 1.0f, therefore you don't see any difference.

Checkout the documentation for more details;

https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier#(androidx.compose.ui.Modifier).fillMaxSize(kotlin.Float)

  • Related