Has anyone else encountered this bug? If I use a B...
# compose
a
Has anyone else encountered this bug? If I use a Button with a Text(text = stringResources(...)), the text will be aligned to the bottom of the button (second image). However, if I use a string directly, everything works just fine (first image / 🧵 with the code and more info) (happening on both
beta-09
and
rc01
)
Everything happens inside a
DialogFragment
It's a Column in which I have some other Composable, and at the bottom I have a Row with 2 buttons: a TextButton and a Button.
If I use the stringResource, I get the 2nd image
Copy code
Row(
                modifier = Modifier.fillMaxWidth(),
                verticalAlignment = Alignment.CenterVertically,
            ) {
                TextButton(
                    onClick = onDenyClick,
                    modifier = Modifier
                        .weight(1f, true)
                        .padding(top = 8.dp)
                        .clip(RoundedCornerShape(24.dp)),
                ) {
                    Text(stringResource(R.string.dont_allow), color = MaterialTheme.typography.body1.color)
                }
                HorizontalSpacer(12.dp)
                Button(
                    onClick = onAllowClick,
                    modifier = Modifier
                        .weight(1f, true)
                        .clip(RoundedCornerShape(24.dp))
                ) {
                    Text(text = stringResource(id = R.string.ok))
                }
            }
However, using directly a rawString works
Copy code
Row(
                modifier = Modifier.fillMaxWidth(),
                verticalAlignment = Alignment.CenterVertically,
            ) {
                TextButton(
                    onClick = onDenyClick,
                    modifier = Modifier
                        .weight(1f, true)
                        .padding(top = 8.dp)
                        .clip(RoundedCornerShape(24.dp)),
                ) {
                    Text(stringResource(R.string.dont_allow), color = MaterialTheme.typography.body1.color)
                }
                HorizontalSpacer(12.dp)
                Button(
                    onClick = onAllowClick,
                    modifier = Modifier
                        .weight(1f, true)
                        .clip(RoundedCornerShape(24.dp))
                ) {
                    Text("OK")
                }
            }
I've tried extracting the
stringResource
beforehand, but I get the same result.
d
Are you sure you have exactly the same text in
strings.xml
? also can it be that some other module contains this string id and it gets merged in and contains some long text/newlines?
a
Good idea, i wil try now
That seemed to actually be the problem
@dimsuz thanks !
💪 2