Как заставить Scaffold TopAppBar переносить высоту содержимого своих дочерних элементов? ⇐ Android
Как заставить Scaffold TopAppBar переносить высоту содержимого своих дочерних элементов?
I tried with Modifier.wrapContentHeight() but it doesn't work.
Seems that ToppAppBar has a fixed height and does not wrap the height of his childrens.
How can that be achieved?
The sample code:
Scaffold( modifier = modifier, topBar = { TopAppBar( modifier = Modifier.wrapContentHeight(), title = { Row( horizontalArrangement = Arrangement.Center, verticalAlignment = Alignment.CenterVertically, modifier = Modifier.fillMaxWidth().padding(8.dp) ) { Image( painterResource(id = R.drawable.foreground), contentDescription = null, modifier = Modifier.size(72.dp), contentScale = ContentScale.Fit ) Text( stringResource(id = R.string.app_name), fontWeight = FontWeight.Bold, style = MaterialTheme.typography.headlineLarge ) } } ) }
Источник: https://stackoverflow.com/questions/780 ... -childrens
I tried with Modifier.wrapContentHeight() but it doesn't work.
Seems that ToppAppBar has a fixed height and does not wrap the height of his childrens.
How can that be achieved?
The sample code:
Scaffold( modifier = modifier, topBar = { TopAppBar( modifier = Modifier.wrapContentHeight(), title = { Row( horizontalArrangement = Arrangement.Center, verticalAlignment = Alignment.CenterVertically, modifier = Modifier.fillMaxWidth().padding(8.dp) ) { Image( painterResource(id = R.drawable.foreground), contentDescription = null, modifier = Modifier.size(72.dp), contentScale = ContentScale.Fit ) Text( stringResource(id = R.string.app_name), fontWeight = FontWeight.Bold, style = MaterialTheme.typography.headlineLarge ) } } ) }
Источник: https://stackoverflow.com/questions/780 ... -childrens
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение