Row 中元素的引力 (Jetpack Compose)

Gravity of elements within Row (Jetpack Compose)

如何设置行内元素的重力? 我的行中有两个图像可组合项。我希望第一个图像位于行的开头,下一个元素位于行的末尾。

我试过:

Row(Modifier.fillMaxWidth()) {

    Image(
        painter = painterResource(id = R.drawable.logo_voodlee),
        contentDescription = "logo",
        modifier = Modifier
            .width(with(LocalDensity.current) { dimensionResource(id = R.dimen._100sdp) })
            .height(with(LocalDensity.current) { dimensionResource(id = R.dimen._55sdp) })
            .offset(x = with(LocalDensity.current) { dimensionResource(id = R.dimen._16sdp) }),
    )

    Image(
        painter = painterResource(id = R.drawable.ic_menu),
        contentDescription = "logo",
        modifier = Modifier
            .width(with(LocalDensity.current) { dimensionResource(id = R.dimen._19sdp) })
            .height(with(LocalDensity.current) { dimensionResource(id = R.dimen._19sdp) })
        ,
    alignment = CenterEnd //This is not working
    )
}

但是没用。

您可以在Row Arrangement.SpaceBetween

申请
Row(
    Modifier.fillMaxWidth(),
    horizontalArrangement = Arrangement.SpaceBetween
) {
    /* ... */
    Box(Modifier.width(50.dp).height(50.dp).background(Red))
    Box(Modifier.width(50.dp).height(50.dp).background(Blue))
}