I am new to jetpack compose and the app Im working on has to have the end of the text to be in the middle of the 9th line. Is there a way to do that? So far its only been able to get the ellipsis to the end of the 9th line. I tried to do 8.5 but that would not work.
This is what I have:
My code:
@Composable
fun ExpandableText(text: String) {
var expanded by rememberSaveable { mutableStateOf(false) }
val maxLines = if (expanded) Int.MAX_VALUE else 9
Text(
modifier = Modifier.padding(top = 16.dp),
text = text,
maxLines = maxLines,
overflow = TextOverflow.Ellipsis,
style = MaterialTheme.typography.body1,
color = MaterialTheme.ts.colors.onBackgroundSecondary,
lineHeight = 20.sp
)
Text(
modifier = Modifier
.padding(top = 16.dp, bottom = 40.dp)
.clickable { expanded = !expanded },
text = stringResource(id = R.string.see_more),
style = MaterialTheme.typography.body2,
color = MaterialTheme.ts.colors.actionColor
)
}