Turning Back to RTL

In order for the “start”/“end” attributes to reverse their positions based on language direction, you need to have android:supportsRtl="true" in your <application> element in your manifest. Most newly-created projects will have this attribute already set for you by the new-project wizard.

To see how your app behaves with RTL — without having to learn Arabic or Hebrew, if you are not literate in those languages — you can force Android to use RTL layout rules with any language on Android 4.2+ devices. To do this, go into the Settings app of the device or emulator and choose “Developer options”. In there, scroll down to the “Force RTL layout direction” item. By default, this is turned off, and so layout direction is determined by the user’s chosen language:

Developer Options in Settings, Normal Mode
Developer Options in Settings, Normal Mode

Tapping that switch uses RTL layout rules — with “start” referring to the right and “end” referring to the left — for all languages:

Developer Options in Settings, Forced-RTL Mode
Developer Options in Settings, Forced-RTL Mode

Prev Table of Contents Next

This book is licensed under the Creative Commons Attribution-ShareAlike 4.0 International license.