< /p>
, поскольку вы можете видеть, что зеленый цвет не покрывает полный экран, но я хочу, чтобы зеленый цвет покрывал весь экран, и панель меню должна быть прозрачной, чтобы увидеть зеленый цвет (я хочу эффект размытия). < /p>
Вот код -> < /p>
.
Код: Выделить всё
@composable
fun BlurredBottomBar(selectedItemIndex: Int, onItemSelected: (Int) -> Unit) {
val iconList = IconLists()
var itemList = iconList.itemList
var selectedItemList = iconList.selectedItemList
Box(
modifier = Modifier
.padding(top = 0.dp, start = 10.dp, end = 10.dp, bottom = 20.dp)
.fillMaxWidth()
.graphicsLayer(shadowElevation = 50f, shape = RoundedCornerShape(50.dp), clip = true)
.background(
Color.Black.copy(0.09f)
)
) {
Row(
modifier = Modifier
.height(60.dp)
.padding(10.dp)
.fillMaxWidth(),
verticalAlignment = Alignment.Bottom,
horizontalArrangement = Arrangement.SpaceBetween
) {
itemList.forEachIndexed { index, icon ->
var iconResId =
if (index == selectedItemIndex) selectedItemList[index] else itemList[index]
IconButton(
modifier = if(selectedItemIndex == index) Modifier.background(
Color.White.copy(alpha = 0.25f),
shape = CircleShape
) else {
Modifier
},
onClick = { onItemSelected(index) }) {
Icon(
painter = painterResource(id = iconResId),
contentDescription = "",
modifier = Modifier.size(25.dp),
)
}
}
}
}
}
< /code>
и в основной активности < /p>
@Composable
fun MainMethod() {
var selectedItemIndex by remember { mutableStateOf(0) }
Scaffold(
modifier = Modifier.fillMaxSize().background(Color.Transparent),
bottomBar = { BlurredBottomBar(selectedItemIndex,onItemSelected = { selectedItemIndex = it })},
content = {
Box(modifier = Modifier.padding(it).background(color = Color.Green).fillMaxSize())
{
Text("Main Content")
}
}
)
}
Подробнее здесь: https://stackoverflow.com/questions/796 ... ire-screen