如何使嵌入在行中的第一列中的元素居中:
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
MaterialTheme {
Row {
Column(modifier = LayoutPadding(top = 16.dp)) {
Text(text = "Centered ", style = TextStyle(fontSize = 30.sp, fontWeight = FontWeight.Bold))
}
Column {
Text(text = "Line One ", style = TextStyle(fontSize = 30.sp, fontWeight = FontWeight.Bold))
Text(text = "Line Two ", style = TextStyle(fontSize = 30.sp, fontWeight = FontWeight.Bold))
}
}
}
}
}
}
在此示例中,我对填充进行了硬编码,但无法弄清楚如何使元素居中。如果没有这样的选项,我怎样才能得到整行的高度?