I've tried everything in this post: Android RTL password fields?
But nothing helped me.
Problem: When a user's locale is Arabic(RTL), I want him to feel comfortable in typing his password in his language. But, when I assign inputType
to textPassword
, it doesn't work and forces it to LTR no matter what I assign.
I've tried assigning the gravity
, textAlignment
, layoutDirection
, and I've even tried it programmatically, but nothing is working.
All the other text fields work fine except for the PASSWORD ones. Is there a workaround for this bug/problem?
I'm here to convince you to stop looking for an answer. Really very few people sets their password using Arabic character (sometimes even the UserName). This is because most password systems are very bad in handling non-latin characters. These system usually assumes passwords are in ASCII not Unicode especially old DB systems. Moreover, keep in mind that sometimes the user finds some difficulty to switch the keyboard to another language layout. This problem used to happen in Windows Login long ago.
These historical and chronic compatibility issues discouraged most people from using non-latin characters in their passwords. I've lived enough and dealt with lots different people (really a lot of people... people with zero computer skills, people using devices in Arabic interface, people with zero English... etc), I have still never heard someone sets his password in Arabic characters... not in the late 90's not even this era. Since the majority sets their password in latin characters, I believe that all login interfaces should be 'layouted' in LTR and also left aligned.
Another thing password field converts text to stars, so there is no difference between starts from right-to-left and starts from left-to-right (sadly mark down down't support align, so please click on run):
<p align="right">******</p>
<p align="left">******</p>
More technical info here
You can set the Text Alignment Left to Right (LTR) or Right to Left (RTL) based on your language (Arabic, Urdu or English) by just setting one property in to Edittext XML file:
android:inputType="textPassword"
android:textAlignment="viewStart"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With