2

I'm facing an issue that when I define an EditText as password type and view my screen in Arabic language the password field hint text is showing on the left side instead of right side [that is expected].

issue

Above is the result I get. I need password hint text to be starting from the right side that's where Arabic writings start. I've also tried adding text gravity to it but no luck.

Marat
  • 6,142
  • 6
  • 39
  • 67
Usman Ghauri
  • 931
  • 1
  • 7
  • 26

2 Answers2

7

Please refer to this post :
Android RTL password fields?

For API 17+ you can use

android:textAlignment="viewStart"
Community
  • 1
  • 1
Nika Kurdadze
  • 2,502
  • 4
  • 18
  • 28
3

Try this:

<EditText
    android:id="@+id/input_password"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:hint="كلمة المرور"
    android:textColorHint="#FFFFFF"
    android:gravity="right"
    android:inputType="textPassword"
    android:background="@null"
    android:textColor="#FFFFFF"
    android:textSize="20dp"/>
  • This is for one case only. What i needed to achieve was i wanted to shift rtl on signup page i.e. If user select arabic it shows layouts in Arabic and if selected in English show English layouts. Setting gravity to right will fix one issue and will create another in English view. I know you'll suggest me to create one layout for Arabic and one for English but thats duplication. im just using strings english and AR and letting the android framework do the trick of rtl shift – Usman Ghauri Feb 22 '17 at 14:08