Anonymous
Коробка, содержащая другую коробку
Сообщение
Anonymous » 19 мар 2024, 13:59
Код: Выделить всё
Column(
modifier = Modifier.weight(0.6f),
horizontalAlignment = Alignment.CenterHorizontally
) {
Row(
modifier =
Modifier.background(brush = color, shape = RoundedCornerShape(5.dp))
.align(Alignment.CenterHorizontally),
// Trying to add shadow and elevation here and my box getting cropped
) {
Column(
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center
) {
Card(
modifier =
Modifier.fillMaxWidth()
.offset(y = (-15).dp)
.align(Alignment.CenterHorizontally)
.padding(horizontal = 10.dp, vertical = 5.dp),
colors =
CardDefaults.cardColors(
containerColor = colorRedLive,
),
shape = RoundedCornerShape(5.dp),
) {
Text(
modifier = Modifier.padding(vertical = 2.dp).fillMaxWidth(),
text = "Live",
textAlign = TextAlign.Center,
style = TextStyle(color = MaterialTheme.colorScheme.onPrimary)
)
}
Text(
modifier = Modifier.offset(y = (-10).dp).fillMaxWidth(),
text = "3 - 5",
textAlign = TextAlign.Center,
style =
TextStyle(
fontWeight = FontWeight(600),
fontSize = 16.sp,
color = MaterialTheme.colorScheme.onPrimary
)
)
}
}
}
Итак, мой вопрос
есть один ящик с тенью и возвышением.
внутри этого ящика у меня есть карточка с текстом «Живой»
Я сделал большая часть этого, но когда я даю высоту и тень, моя живая карта с текстом обрезается / обрезается с макушки.
Подробнее здесь:
https://stackoverflow.com/questions/781 ... nother-box
1710845955
Anonymous
[code]Column( modifier = Modifier.weight(0.6f), horizontalAlignment = Alignment.CenterHorizontally ) { Row( modifier = Modifier.background(brush = color, shape = RoundedCornerShape(5.dp)) .align(Alignment.CenterHorizontally), // Trying to add shadow and elevation here and my box getting cropped ) { Column( horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.Center ) { Card( modifier = Modifier.fillMaxWidth() .offset(y = (-15).dp) .align(Alignment.CenterHorizontally) .padding(horizontal = 10.dp, vertical = 5.dp), colors = CardDefaults.cardColors( containerColor = colorRedLive, ), shape = RoundedCornerShape(5.dp), ) { Text( modifier = Modifier.padding(vertical = 2.dp).fillMaxWidth(), text = "Live", textAlign = TextAlign.Center, style = TextStyle(color = MaterialTheme.colorScheme.onPrimary) ) } Text( modifier = Modifier.offset(y = (-10).dp).fillMaxWidth(), text = "3 - 5", textAlign = TextAlign.Center, style = TextStyle( fontWeight = FontWeight(600), fontSize = 16.sp, color = MaterialTheme.colorScheme.onPrimary ) ) } } } [/code] Итак, мой вопрос есть один ящик с тенью и возвышением. внутри этого ящика у меня есть карточка с текстом «Живой» Я сделал большая часть этого, но когда я даю высоту и тень, моя живая карта с текстом обрезается / обрезается с макушки. Подробнее здесь: [url]https://stackoverflow.com/questions/78185722/box-which-contains-of-another-box[/url]