android EditText android:textDirection
Asked Answered
E

4

7

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

Edmea answered 6/10, 2012 at 20:20 Comment(2)
Check out this answer: https://mcmap.net/q/281594/-android-setting-with-textview-for-hebrew-textShanell
adding the unicode LTR mark does seem to have an effect.Edmea
E
1

Adding \u202D (LTR OVERRIDE) to the beginning of the string does the trick

Edmea answered 10/10, 2012 at 6:49 Comment(0)
T
5

use gravity for the editText

android:gravity="right"
Transcription answered 6/10, 2012 at 20:34 Comment(3)
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 developerTranscription
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
E
1

Adding \u202D (LTR OVERRIDE) to the beginning of the string does the trick

Edmea answered 10/10, 2012 at 6:49 Comment(0)
H
0

use direction for the editText

android:textDirection="ltr"
Heaton answered 27/11, 2013 at 10:35 Comment(0)
X
0

Add these to your EditText:

android:gravity="left"
android:textDirection="ltr"

Note: android:textDirection requires API level 17

Xylina answered 29/7, 2017 at 14:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.