Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Passing argument 1f to fillMaxSize() – Purpose?

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?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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.

>Solution :

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)

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading