samuel
07/31/2022, 1:10 PMText
composable overflows. I came across TextLayoutResult.getLineEnd
that seems like it could help me in this case. However, i need to supply the lineIndex
. How would i go about getting the lineIndex
of the line that is overflowing?samuel
07/31/2022, 1:13 PMText(
text = "my text",
modifier = Modifier.fillMaxWidth(),
overflow = TextOverflow.Ellipsis,
onTextLayout = { textLayoutResult ->
if (textLayoutResult.didOverflowHeight || textLayoutResult.didOverflowWidth) {
val overFlowingLineIndex = textLayoutResult.getLineEnd(
// Using the first line here, but i would like to compute the the line index of the overflow
lineIndex = 0,
visibleEnd = true
)
}
},
)
Siyamed
07/31/2022, 3:44 PMsamuel
07/31/2022, 6:42 PMlineCount-1
is exactly what i needed, thank you 😄