Chris Johnson
12/06/2021, 10:15 PMText
composable, it seems the text is wrapping to a new line when it does not need to because the the text is so long and has no spaces in between. I noticed if I add spaces to the text it will wrap correctly. First image is wrong (current behavior) second image is what I want. Is this a bug with how Text calculates its MultiParagraph
object? Or is there a setting I'm missing... Code and images in 🧵val annotatedString = buildAnnotatedString {
append(stringResource(id = R.string.attachment))
withStyle(SpanStyle(ColorPrimary())) {
append("sample file name here that is long but wraps correctly because I added spaces.pdf")
}
}
Text(text = annotatedString, style = typography.body1, color = ColorSecondary(), modifier = Modifier
.clickableNoIndication { onPdfClicked() }
.clip(RoundedCornerShape(spacing_standard))
.background(ColorSurfaceVariant())
.padding(spacing_standard))
Casey Brooks
12/06/2021, 10:28 PMChris Johnson
12/06/2021, 10:32 PMTextView
seems to handles it differently and I'm trying to reproduce that 😕 .efemoney
12/07/2021, 5:53 PMChris Johnson
12/07/2021, 6:43 PM<TextView
android:id="@+id/messageBubble"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="10dp"
android:paddingTop="5dp"
android:paddingEnd="10dp"
android:paddingBottom="6dp"
tools:visibility="visible" />
This ^. I noticed if I remove the padding it behaves like compose does. But if I add that same padding to my composable it still wraps prematurely