0

im creating a view using jetpack-compose. i have a view and i want it to be align to right of the Box. i don't want to use end or start. how to do it? i saw absoluteAlignment but its not working

modifier = Modifier.align(AbsoluteAlignment.Left)

one solution was:

CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Rtl) {
            // Add your app composable elements here
        }

and use start and end based on that. but i want to know if there is any posibility to use RIGHT or LEFT directly.

Sep
  • 147
  • 8
  • 5
    Compose has (correctly) abstracted away left and right into start and end. Why do you want to break that feature? – Jorn Jun 20 '23 at 11:55
  • can you put up full code of the composable? – ehsan khormali Jun 20 '23 at 19:58
  • Can you please let us know why you don't want to use `end or start` What's the problem with end or start that you are facing? Or are you trying to mean something else? You may check this link https://stackoverflow.com/a/74647369/10599979 if you want to align your elements with box. – Ariful Haque Jun 20 '23 at 20:19

1 Answers1

0

you can use horizontalArrangement of the Row() composable

Row(modifier = Modifier.fillMaxWidth(),
    horizontalArrangement = Arrangement.Absolute.Right) {
        Text(text = "your Text Aligned right")
    }