l

    Lilly

    11 months ago
    I have problems to arrange/align a text in a
    Box
    with a vector image on various devices. I would like to scale the image to 
    FillWidth
      but this has the side effect that the height is different on various devices and so the bottom padding too. How can I arrange the text in the center of the gray area so it has the same position on all devices? What I also don't understand is why the smaller preview looks different on real device, although the given specs and the specs of device are the same (device = "spec:Normal;480;800;px;320dpi").
    Jan Bína

    Jan Bína

    11 months ago
    I think that the best solution would be to use
    Modifier.align()
    on your Text composable with something like
    BiasAlignment(horizontalBias = 0F, verticalBias = 0.5F)
    , where you tweak the
    0.5F
    value to fit your image.
    l

    Lilly

    11 months ago
    Good point. Do you know why the text looks so different. It's hard to predict the output on different devices especially because the preview doesn't reflect what is actually shown on device.