Zhang Zihan
06/24/2024, 10:45 AMText()
? I am writing a text reader that flips pages left and right. It needs to fill the first page with text, then fill the second page with the remaining text, then fill the third page with the remaining text, and so on.Raphael TEYSSANDIER
06/24/2024, 10:50 AMonTextLayout = { it.hasVisualOverflow }
Zhang Zihan
06/24/2024, 10:55 AMRaphael TEYSSANDIER
06/24/2024, 12:01 PMTextLayoutResult
, that help you with what you wantZach Klippenstein (he/him) [MOD]
06/24/2024, 4:54 PMZhang Zihan
06/24/2024, 11:37 PMText(
text = sampleText,
onTextLayout = { textLayoutResult ->
with(textLayoutResult) {
val lastLine = getLineForVerticalPosition(size.height.toFloat())
val lineEnd = getLineEnd(lastLine)
remaingText = sampleText.substring(lineEnd)
}
}
}