android:gravity="start" not working on TextViews on RTL locales
See original GitHub issueIt seems the lib is making TextViews to ignore (or have inverted) the setting android:gravity=“end/start” when RTL is used (by choosing hebrew as the device language for example).
If you set the device in Hebrew and have a TextView:
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="start"
android:text="hello world" />
Current result: the text appears aligned to the left (which is wrong) because the devices is currently RTL.
Expected result: the text should appear aligned to the right.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:3
- Comments:7 (2 by maintainers)
Top Results From Across the Web
use locale (ltr/rtl) for gravity in TextView - android
The obvious choice would be: android:gravity="start" but then e.g. english text will always be left-aligned and hebrew right-aligned.
Read more >Android – use locale (ltr/rtl) for gravity in TextView - iTecNote
The obvious choice would be: android:gravity="start" but then e.g. english text will always be left-aligned and hebrew right-aligned. Here is how it looks...
Read more >Support different languages and cultures - Android Developers
Some users choose a language that uses right-to-left (RTL) scripts, such as Arabic or Hebrew, for their UI locale.
Read more >Supporting RTL Design on Android - droidcon
Otherwise, your app will not support the RTL design. ... meaning “layout direction right-to-left” for resources working on RTL languages.
Read more >Dos and Don'ts for Developing Multilingual Android Apps
It also provides mechanisms for locale awareness, resource loading, ... and you don't add the resConfigs property, it will not work properly, and...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I have met the same issue, though I did not use this library…
I googled why I met this issue, and luckily I found a solution.
Add
rather than
android:gravity="start"
And it does work.
@richardjbs This will still show the text on the left because you have hard-coded a western character set. If you use a reference to @string/hello_world and replace that in strings.xml for both values-en and values-iw (for hebrew) it should work as expected.
I’m working on a project which supports Arabic and English and have seen this many times. I don’t believe Calligraphy is related to this issue.