https://kotlinlang.org logo
#compose
Title
# compose
n

nuhkoca

04/13/2022, 10:04 AM
Hello, is there a better way to center align this icon button to the text rather than using offset? It a little bit looks off to me.
1
c

Csaba Szugyiczki

04/13/2022, 10:28 AM
I guess you already put them in a
Row
If yes, the Row has a
verticalAlignment
parameter to which you can pass
Alignment.CenterVertically
1
👍 1
c

Chris Sinco [G]

04/13/2022, 10:36 AM
Depending what version of Compose you are using, includeFontPadding may still be on, which has led to less than pixel perfect vertical alignment with Text in the past, which in that case requires tiny nudges with offset 😔
✔️ 2
n

nuhkoca

04/13/2022, 11:27 AM
Thank you guys for a quick turnaround, I think I fixed it using custom layout but there is another problem 😞 Even though I wrap both
title
and
description
inside a
Column
, the
description
doesn’t respect to the `title'`s space and overlaps it. Do you know why?
My layout
Copy code
Layout(
    modifier = Modifier
        .padding(horizontal = TRTheme.spacing.default)
        .padding(top = TRTheme.spacing.default, bottom = TRTheme.spacing.single),
    content = {
        ...
    }) { measurables, constraints ->
    ...
ok, instead of
maxHeight
, used placeables’ height and it is fixed 🙂
👍 1
12 Views