2

On Android we can use android determine if device is in right to left language/layout.

But does Jetpack Compose provide any API to check the layout direction? Without interacting with the resources or other Android APIs.

Raed Mughaus
  • 975
  • 1
  • 9
  • 15

1 Answers1

8

We can use LocalLayoutDirection

Box(
    contentAlignment = Alignment.Center,
    modifier = Modifier.fillMaxSize()
) {
    if (LocalLayoutDirection.current == LayoutDirection.Rtl) {
        Text("RTL")
    } else {
        Text("LTR")
    }
}
Raed Mughaus
  • 975
  • 1
  • 9
  • 15