SelectionContainer {
Text(
text = valueText,
style = if (lowKey) MaterialTheme.typography.bodyMedium else MaterialTheme.typography.bodyLarge,
lineHeight = MaterialTheme.typography.bodyMedium.lineHeight,
color = if (lowKey) MaterialTheme.colorScheme.onSurfaceVariant else MaterialTheme.colorScheme.onBackground,
maxLines = 5,
overflow = TextOverflow.Ellipsis,
)
}
The above code, if the text content is relatively long, such as 200 characters, I will only select a small portion of the text after long pressing. How to achieve default selection by long pressing?
kotlin = “2.0.0”
composeBom = “2024.04.01”
I hope there is a way to enable default selection of all text when long pressed.
sandywkqqcom is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1