I'd like to set an EditText to be LTR at all times, how do I do that? android:textDirection does seem to be the answer, i cant get the project to compile with that directive
android EditText android:textDirection
Asked Answered
Check out this answer: https://mcmap.net/q/281594/-android-setting-with-textview-for-hebrew-text –
Shanell
adding the unicode LTR mark does seem to have an effect. –
Edmea
Adding \u202D (LTR OVERRIDE) to the beginning of the string does the trick
use gravity for the editText
android:gravity="right"
I think OP means LTR as in Arabic language, not as aligned to the right. –
Corncob
but when you aligned the arabic text to right its will appear correctly. im an arabic developer –
Transcription
aligning to the right would work if I wanted RTL text. what I need is LTR directional text. a text that's aligned to the left and in case the chars "aa bb" are inserted the Edit text the text should display "aa bb" and not "bb aa" which is the case when using an RTL language (Hebrew in my case). –
Edmea
Adding \u202D (LTR OVERRIDE) to the beginning of the string does the trick
use direction for the editText
android:textDirection="ltr"
Add these to your EditText
:
android:gravity="left"
android:textDirection="ltr"
Note: android:textDirection
requires API level 17
© 2022 - 2024 — McMap. All rights reserved.