Ryan Simon
06/23/2022, 5:00 PMHalil Ozercan
06/23/2022, 5:07 PMRyan Simon
06/23/2022, 5:08 PMHalil Ozercan
06/23/2022, 5:10 PMRyan Simon
06/23/2022, 5:12 PMchatterInDaSkull
06/23/2022, 5:15 PMInlineTextContent
?Ryan Simon
06/23/2022, 5:36 PMchatterInDaSkull
06/23/2022, 5:37 PMRyan Simon
06/23/2022, 5:38 PMHalil Ozercan
06/23/2022, 5:43 PMInlineTextContent
does exactly what its name suggests; it inlines the content. So, content is placed on a single line, other lines do not wrap around it 😕Ryan Simon
06/23/2022, 5:49 PMInlineTextContent
AndroidView
next with this library: https://github.com/deano2390/FlowTextViewSean McQuillan [G]
06/23/2022, 6:33 PMRyan Simon
06/23/2022, 6:51 PMsamuel
07/31/2022, 2:08 PM@Preview
@Composable
private fun TextWrappedAroundBox() {
val text = remember {
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor " +
"incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quisss nostrud " +
"exercitation ullamco laboris nisi ut aliquip ex ea nisi commodo consequat. Duis aute " +
"irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla " +
"pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia " +
"deserunt mollit anim id est laborum."
}
var overflowingText by remember { mutableStateOf("") }
Column(
modifier = Modifier
.fillMaxWidth()
.wrapContentHeight()
) {
Row(
modifier = Modifier
.height(50.dp)
.fillMaxWidth()
) {
Box(
modifier = Modifier
.size(50.dp)
.background(color = Color.Red)
)
Text(
text = text,
maxLines = 3,
modifier = Modifier.weight(1f).padding(start = 2.dp),
overflow = TextOverflow.Clip,
onTextLayout = { textLayoutResult ->
if (textLayoutResult.hasVisualOverflow) {
val lineEndIndex = textLayoutResult.getLineEnd(
lineIndex = 2, // Max lines - 1
visibleEnd = true
)
overflowingText = text.substring(lineEndIndex)
}
},
)
}
if (overflowingText.isNotBlank()) {
Text(
text = overflowingText,
modifier = Modifier.fillMaxWidth(),
)
}
}
}
Ryan Simon
07/31/2022, 2:50 PM