[android-components](../../index.md) / [mozilla.components.support.locale](../index.md) / [LocaleAwareAppCompatActivity](index.md) / [setLayoutDirectionIfNeeded](./set-layout-direction-if-needed.md)

# setLayoutDirectionIfNeeded

`fun setLayoutDirectionIfNeeded(): `[`Unit`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) [(source)](https://github.com/mozilla-mobile/android-components/blob/master/components/support/locale/src/main/java/mozilla/components/support/locale/LocaleAwareAppCompatActivity.kt#L34)

Compensates for a bug in Android 8 which doesn't change the layoutDirection on activity recreation
https://github.com/mozilla-mobile/fenix/issues/9413
https://stackoverflow.com/questions/46296202/rtl-layout-bug-in-android-oreo#comment98890942_46298101

