Приведенный ниже код отлично работает на Android 14-, но на Android 15 нижняя часть всплывающей подсказки обрезана:
[img]https:/ /i.sstatic.net/JFR7OO2C.png[/img]
Нижняя часть красной рамки отсутствует, видна только верхняя часть буквы «g».
Похоже, не хватает высоты верхней строки состояния. Как это исправить? Код:
val tenLines = """
000
111
222
333
444
555
666
777
888
999
""".trimIndent()
val veryLongTooltip =
tenLines + tenLines + tenLines + tenLines + tenLines + tenLines +
"\n" +
"end aaaaaa bbbbbbb cccccc dddddd eeeeee fffffff ggggggg"
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
enableEdgeToEdge()
setContent {
TestTheme {
Scaffold { innerPadding ->
Column(
modifier = Modifier.padding(innerPadding),
) {
TooltipButton(tooltipText = veryLongTooltip)
}
}
}
}
}
}
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun TooltipButton(tooltipText: String) {
val tooltipState = rememberTooltipState(isPersistent = true)
TooltipBox(
positionProvider = TooltipDefaults.rememberRichTooltipPositionProvider(),
tooltip = {
RichTooltip(
shape = RoundedCornerShape(5.dp),
modifier = Modifier
.border(4.dp, Color.Red, shape = RoundedCornerShape(5.dp))
) {
Text(
tooltipText,
fontSize = 18.sp,
modifier = Modifier.verticalScroll(rememberScrollState())
)
}
},
state = tooltipState
) {
val coroutine = rememberCoroutineScope()
Button(
onClick = {
coroutine.launch { tooltipState.show() }
}
) {
Text("click to show the tooltip")
}
}
}
Подробнее здесь: https://stackoverflow.com/questions/791 ... een-height