我正在尝试构建此布局:
我尝试使用此代码(以及权重的一些变化):
@Composable
fun TodayRow(amount: String) {
Row(
verticalAlignment = Alignment.CenterVertically,
modifier = Modifier
.background(colorResource(id = R.color.bg_creamy))
.height(dimensionResource(id = R.dimen.list_item_height_normal))
) {
Divider(
color = colorResource(id = R.color.dark_mode_black_2),
modifier = Modifier
.width(14.dp)
)
Text(
text = stringResource(id = R.string.today),
fontWeight = FontWeight.Medium,
color = colorResource(id = R.color.dark_mode_black_2),
fontSize = 13.sp,
modifier = Modifier
.padding(start = 2.dp, end = 2.dp)
)
Divider(
color = colorResource(id = R.color.dark_mode_black_2),
modifier = Modifier
.padding(end = 2.dp)
)
Text(
text = amount,
fontWeight = FontWeight.Medium,
color = colorResource(id = R.color.dark_mode_black_2),
fontSize = 13.sp,
modifier = Modifier
.padding(end = 2.dp)
)
Divider(
color = colorResource(id = R.color.dark_mode_black_2),
modifier = Modifier
.width(14.dp)
)
}
}
我该如何解决这个问题?
答案 0 :(得分:0)
这是因为您在第二个分隔符上使用了结束填充。它一直延伸到距离屏幕边缘只有两个 dp。试试权重