Вот код, показывающий, что я делаю, мой составной объект заключен во фрагмент. В настоящее время я использую столбец, я также пробовал использовать Scaffold с тем же результатом.

@OptIn(ExperimentalMaterial3Api::class)
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
return ComposeView(requireContext()).apply {
setContent {
val uiState = viewModel.uiState.collectAsState()
viewModel.setIntent(MapIntent.GetOneOrAll(id))
Column {
if (uiState.value.hasToolbar) {
CenterAlignedTopAppBar(
modifier = Modifier.fillMaxWidth().wrapContentHeight(),
title = {
Text(
text = uiState.value.toolbarTitle ?: "", maxLines = 1, overflow = TextOverflow.Ellipsis,
color = colorResource(id = R.color.white)
)
},
navigationIcon = {
IconButton(onClick = { /* doSomething() */ }) {
Icon(
imageVector = Icons.Filled.ArrowBack,
contentDescription = null,
tint = colorResource(id = R.color.white)
)
}
},
actions = {
IconButton(onClick = { /* doSomething() */ }) {
Icon(
imageVector = Icons.Filled.Menu,
contentDescription = null,
tint = colorResource(id = R.color.white)
)
}
},
colors = TopAppBarDefaults.centerAlignedTopAppBarColors(
containerColor = colorResource(id = R.color.colorPrimaryDark),
)
)
}
MapView(
modifier = Modifier.fillMaxSize(),
onMapClick = { viewModel.setIntent(MapIntent.OnClickMap) },
onMarkerClick = { viewModel.setIntent(MapIntent.OnClickMarker(it)) },
cameraPositionState = uiState.value.cameraPositionState,
markers = uiState.value.markers
)
}
}
}
}
Подробнее здесь: https://stackoverflow.com/questions/760 ... at-the-top
Мобильная версия