Android can mirror an entire screen for right-to-left languages, but only after the app declares that its layouts are ready. That declaration is the manifest attribute android:supportsRtl, and it decides whether the system applies RTL behaviour or leaves the interface exactly as it is.
The flag alone does not fix a layout. Screens that use fixed left and right spacing still look wrong after mirroring, because those values never move. This guide covers the manifest change, the attributes that follow the layout direction automatically, and the checks that catch everything else.
You will see a minimal example first, then the layout rules, testing steps and the problems that tend to appear when a real app moves to Arabic, Hebrew, Persian or Urdu.
What Android supportsRtl Means
Right-to-left languages and layout direction
Most Android layouts are written for left-to-right reading. Arabic, Hebrew, Persian and Urdu read from the right, so the natural order of a toolbar, a list row and a form label reverses.
The framework can perform that reversal. Padding, margins, gravity, compound drawables and the visual order of many views are mirrored when the layout direction is RTL and the app has declared support.
What the flag actually changes
With support declared and a suitable target SDK, the framework enables its RTL APIs. Without the flag, an RTL locale still translates your strings, but the surrounding layout keeps its left-to-right geometry.
The change is limited to layout direction. It does not translate text, convert numerals, or guess which icons should flip. Those remain design decisions.
Enable RTL in AndroidManifest.xml
Declare support on the application element
Set the attribute once on <application> so that it applies to every activity in the app.
<application
android:supportsRtl="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity" />
</application>
Target SDK and behaviour
The attribute has the intended effect when the app targets API level 17 or higher. On lower target levels the RTL APIs may be ignored, so an older project can declare support and still see no mirroring at all.
If mirroring seems broken, check the target SDK before rewriting any layout. A single manifest value explains most of these reports.
Use start and end Instead of left and right
Padding, margin and gravity
Replace layout_marginLeft with layout_marginStart, layout_marginRight with layout_marginEnd, and the left and right padding attributes with their start and end equivalents. Gravity follows the same rule: use start and end rather than left and right.
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:paddingStart="8dp"
android:paddingEnd="8dp"
android:gravity="start"
android:text="@string/welcome_message" />
These attributes resolve against the current layout direction, so the same XML works in both languages without a second file.
Drawables and directional icons
Compound drawables offer start and end variants, and image views can request automatic mirroring. Decide per icon: a clock, a brand mark or a play button keeps its meaning, while an arrow that means "forward" or "next" usually should flip.
Build an RTL-Friendly Layout
A linear layout example
A row with an avatar, a name and a status line is a good test case. With start and end attributes, the avatar moves to the right automatically and the text aligns to the right edge.
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingStart="16dp"
android:paddingEnd="16dp">
<ImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:src="@drawable/avatar_placeholder"
android:contentDescription="@string/profile_photo" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginStart="12dp"
android:gravity="start"
android:text="@string/profile_name" />
</LinearLayout>
Constraint layout notes
Constraint layouts mirror the start and end constraints automatically. Constraints written as left and right stay where they are, which is why mixed attribute styles produce half-mirrored screens that look worse than a layout that never mirrored at all.
Audit the layout files for any remaining directional attribute rather than fixing screens one by one from screenshots.
Toolbar, tabs and navigation
App bars, tab layouts and navigation drawers follow the layout direction once the app supports it, provided the XML uses start and end. The navigation icon, the overflow menu and the drawer edge all move to the opposite side, which is the behaviour a native RTL app is expected to show.
Test these components with a long translated title, because RTL strings frequently run wider than their English source and can push actions out of the bar.
Text Direction and Localization
Locale-aware strings
Keep user-facing text in string resources and provide translated values for each language you support. A layout that mirrors correctly but shows English text is only half finished.
Numbers, dates and currency also need attention. Format them with locale-aware APIs instead of concatenating digits and separators by hand.
Mixed-direction text
Text that mixes Arabic and Latin characters can reorder unexpectedly. Where the direction genuinely matters, set it explicitly on the view, and test a value that starts with a number or a Latin product name.
Text alignment deserves the same review. Prefer start and end gravity over centred alignment inside list rows, and check that multi-line paragraphs wrap from the correct edge.
RTL in Lists and Recycler Views
Row layout direction
List rows usually inherit the direction correctly, so the leading icon, the title and any trailing value swap places without extra work. Problems appear when a row is built in code with manual margins or an adapter that positions views by pixel offset.
Dividers, swipe actions and progress
Swipe-to-delete directions, drag handles and progress indicators need a deliberate decision. A swipe that starts from the trailing edge in one language starts from the leading edge in the other, so any threshold calculated from a raw X coordinate has to be direction-aware.
Testing an RTL Android App
Force the layout direction
Developer options include a force RTL layout direction switch, which mirrors the interface without changing the device language. It is a fast way to spot spacing problems, but it is not a substitute for the real locale.
Test real languages
Switch the device to Arabic or Hebrew and walk through the app. Translated strings are often longer or shorter than the English source, so fixed-width labels and single-line buttons that survived the first test can still clip.
- Check toolbars, navigation drawers and tab bars.
- Check list rows with icons and text.
- Check forms, error messages and dialogs.
- Check charts, progress bars and swipe gestures.
- Check screenshots after rotation and font scaling.
A repeatable checklist
RTL verification is easier when it follows the same route each time. A short pass that covers the main flows is more useful than an occasional deep review of one screen.
| Area | What to verify |
|---|---|
| Manifest and build | supportsRtl declared, target SDK at 17 or higher |
| Layout XML | No remaining left or right padding, margin or gravity |
| Text | Translated strings present, alignment follows direction |
| Icons | Directional icons flip, meaning-neutral icons do not |
| Interaction | Swipe, drag and drawer gestures behave correctly |
| Accessibility | Reading order and focus movement remain logical |
Common supportsRtl Problems
Nothing mirrors at all
Look for a missing attribute, a low target SDK, or a layout that was written entirely with left and right values. Any one of those can make the app look unaffected.
Only some screens flip
That usually means some layouts use start and end while others still use fixed sides. It can also mean views were positioned in code with left and right offsets that the XML change never touched.
Icons point the wrong way
Automatic mirroring flips the visual direction of an image, not its meaning. Exclude icons that must not change, and provide a mirrored drawable where the direction is genuinely part of the message.
Layout looks stretched or clipped
Mirrored screens expose fixed widths that were invisible in English. Replace them with weights, wrap content or constraints, and retest with the longest translated string you expect.
RTL in Java and Kotlin Code
Reading the current layout direction
Some behaviour cannot be decided in XML. Read the resolved direction before choosing an animation, a swipe threshold or an icon.
boolean isRtl = getResources().getConfiguration()
.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL;
val isRtl = resources.configuration.layoutDirection ==
View.LAYOUT_DIRECTION_RTL
Avoid hard-coded offsets in code
Programmatic margin changes and canvas drawing often use raw left and right values. Replace them with direction-aware measurements, or the screen will look correct in one language and shifted in the other.
Animations and transitions
A slide-in panel that animates from a fixed pixel position needs its start point derived from the current direction. Otherwise the panel appears to enter from the wrong side while the final layout is correct.
Accessibility and RTL Design
Mirroring changes position, not reading order. Keep the view hierarchy in a logical sequence so screen readers announce content in the order a person expects, and verify focus movement with a keyboard or switch access.
Check touch targets after mirroring, because a control pushed toward one edge can end up closer to a gesture area than intended. Contrast, font size and text scaling matter in every language, not only the one you tested first.
Rolling Out RTL Support Safely
Work through the layouts first
A practical migration starts with an audit rather than a code change. List the screens, find the directional attributes, and convert them in batches so each batch can be tested on its own.
Keep the change reversible
Ship the manifest change together with the layout fixes, not before them. Declaring support while half the app still uses fixed sides produces a worse experience than waiting, and it is harder to diagnose later.
FAQ
What does android:supportsRtl true do?
It tells the system that the app is prepared for right-to-left layouts so the RTL APIs can mirror padding, margins, gravity and other direction-aware values.
Which Android versions support RTL layouts?
Native RTL support arrived with API level 17. The attribute works as expected when the app targets that level or higher.
Why should I use start and end instead of left and right?
Start and end resolve against the current layout direction, so the same layout file adapts to both reading directions without duplication.
How do I test an RTL layout quickly?
Use the force RTL developer option for a fast check, then repeat the test with the device set to a real RTL language and realistic translated text.
Does Android mirror every icon automatically?
No. Mirroring applies where the layout or drawable requests it, and icons whose meaning must not change should be excluded deliberately.
Do I need a separate layout folder for RTL?
Usually not. Direction-aware attributes handle most cases, and a mirrored layout variant is only needed for designs that genuinely differ between reading directions.
Conclusion
Enabling RTL support is a manifest change, but a working RTL app comes from direction-aware layouts. Declare support, target a recent API level, and replace fixed left and right values with start and end.
Then test with real languages, real strings and real gestures. The screens that survive that pass are the ones that will look intentional to a reader who never sees the left-to-right version.




(1) Comments
Tirthraj Pandey
Good....
Write a comment