Thread
#compose
    Rahul Sainani

    Rahul Sainani

    1 year ago
    Is anybody else also stuck with text not being vertically center in buttons, top app bar, etc? Seems a bit towards the top than center.
    Rahul Sainani

    Rahul Sainani

    1 year ago
    Looks center in your preview but not here. Tried putting just text and even row with vertically center alignment inside the button but doesn't work.
    Cicero

    Cicero

    1 year ago
    Could this be something in your theme?
    Could I have your code snippet to compile here?
    o

    okarm

    1 year ago
    That font looks like Poppins. If it is then I gotta tell you that Poppins is not vertically centered. If you want to achieve that you'll have to eyeball a top offset to counteract that. Been burned by Poppins before...
    In the View system there is an attribute to remove implicit bottom padding from a TextView that was meant as an extra space for descenders. That did help to push the glyphs down alittle bit. Dunno if something like that exists in Compose.
    Rahul Sainani

    Rahul Sainani

    1 year ago
    Yes you're right! It's Poppins and the issue is definitely in the font. Will look for that property on compose. Thank you both! 🙌
    c

    Chris Grigg

    1 year ago
    I think you’re seeing the same font padding issue as me!
    When I posted about it here, someone suggested I open an issue on the Jetpack Compose feature tracker. I did, it got marked as duplicate, and it appears that there’s been a little activity on the existing issue since I posted!
    Rahul Sainani

    Rahul Sainani

    1 year ago
    Upvoted and starred, yeah something like this is definitely needed. Is the -25f thing working for you well on different devices or does it need a density multiplier? I'm definitely gonna try this till there is a solution, thanks for sharing!
    c

    Chris Grigg

    1 year ago
    Tbh I haven’t tried it on other devices, I’m spoiled by only having to target one particular device with a specific resolution. I would expect to need to tweak it so it works correctly on other devices, though. I’m not experienced enough with Android to advise there, this is just the way I’d handle something like this in CSS.
    Also note that the -25f thing is usually just a starting point, I’ve been fine tuning as necessary. I’d also expect other fonts to be different. It all feels so hacky, I hope there’s a better solution soon!