Home > Net >  Type mismatch: inferred type is androidx.compose.ui.Alignment.Vertical but androidx.compose.foundati
Type mismatch: inferred type is androidx.compose.ui.Alignment.Vertical but androidx.compose.foundati

Time:09-27

I am facing below error, I am new in compose

Type mismatch: inferred type is androidx.compose.ui.Alignment.Vertical but androidx.compose.foundation.layout.Arrangement.Vertical was expected

Simply, I know package was mismatch as error.

Code

Column(modifier = Modifier
            .padding(16.dp)
            .fillMaxWidth(),
            verticalArrangement = Alignment.CenterVertically
        ) 

Anyone have idea how to fix it or why this error generate?

Thanks in advance.

CodePudding user response:

The verticalArrangement attribute in the Column requires androidx.compose.foundation.layout.Arrangement.Vertical value and you are using androidx.compose.ui.Alignment.Vertical (used by verticalAlignment in the Row).

Use:

Column(
    modifier = Modifier
        .padding(16.dp)
        .fillMaxWidth(),
    verticalArrangement = Arrangement.Center
)
  • Related