Thread
#compose
    Grigorii Yurkov

    Grigorii Yurkov

    1 year ago
    Please, help, what do I do wrong? I'm trying to make simple switch
    Halil Ozercan

    Halil Ozercan

    1 year ago
    Align is a special modifier for Box layout, also known as Stack. If you want to align in a Row, you can add
    weight(1f)
    modifier to Text composable.
    Or simply use SpaceBetween for Row arrangement. I'm not sure if that would achieve the same result you were expecting.
    Grigorii Yurkov

    Grigorii Yurkov

    1 year ago
    Yeah, I tried to use Space with weight, but I didn't find Composable function for it
    t

    tieskedh

    1 year ago
    There are different types of Alignment. Column supports vertical allignment and row supports horizontal allignment. You can call align for the surrounding type. Therefor your code does not compile. Choosing the right one would allow you to align. Don't need to know: The reason you're getting a more complex exception is because of DSLMarker (edited) Are you confusing Row (vertical) with Column (Horizontal)?
    Grigorii Yurkov

    Grigorii Yurkov

    1 year ago
    I need so-called "gravity"
    For example in native android I can make a TextView with width=matchparent and gravity=end. As a result I get Textview at the end of the screen
    Zach Klippenstein (he/him) [MOD]

    Zach Klippenstein (he/him) [MOD]

    1 year ago
    @tieskedh it's actually the other way around. Column and Row only support alignment on their "cross" axis, not the main one. So row only supports vertical alignment. This is why the dsl marker is throwing - you're passing
    End
    , which is a horizontal alignment, to the
    align
    modifier from the Row scope, which only accepts vertical alignments. @Grigorii Yurkov In compose, "gravity" and "alignment" mean the same thing (gravity modifiers and parameters were recently renamed to align). Both Halil's suggestions should work.
    Yeah, I tried to use Space with weight, but I didn't find Composable function for it
    Can you elaborate?
    Spacer(Modifier.weight(1f))
    should do the trick.
    t

    tieskedh

    1 year ago
    @Zach Klippenstein (he/him) [MOD], oh, you're completely right! Thx for correcting!
    Grigorii Yurkov

    Grigorii Yurkov

    1 year ago
    @Zach Klippenstein (he/him) [MOD] Spacer works fine, thank you