Search code examples
androidkotlinmigrationmanifestright-to-left

Android manifest Enable RTL flag for specific part of layouts


We have a big Android project with hundreds of layout files, and we currently are creating 2 layout files for every View (Fragment/Dialog...) one default and on RTL layout, which is a lot of effort to maintain and we are looking to enable android:supportsRtl="true" but its really hard to enable it and migrate/fix all layouts at once, and it will require a lot of work.

The question is: is it possible to enable this flag for some Layouts only and start working on this transition/migration slowly over time? or there is no way but to work on it all at once?


Solution

  • While still requires some work, you can go over your layouts (xmls) and add:

    android:layoutDirection="ltr"
    

    or

    android:layoutDirection="rtl"
    

    To the root layout of each xml files. This will force the direction for this specific layout.