行内に埋め込まれた最初の列内の要素を中央に配置する方法:
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))
}
}
}
}
}
}
この例では、パディングをハードコーディングしましたが、要素をボックスの外に中央揃えする方法を理解できませんでした。そのようなオプションがない場合、行全体の高さを取得するにはどうすればよいですか?