jojo
jojo

Reputation: 473

Multiple language issue in EditText Android

enter image description hereenter image description hereenter image description hereI am using 2 type edit text in my login page. In Arabic EditText gravity is END.But hint in EditText getting left align Why?. When i give inputType="textPassword" no issues. Issues in android:inputType="textEmailAddress"

EditText code given below

<EditText
       android:layout_width="match_parent"
       android:layout_height="wrap_content"  
       android:hint="@string/userName"
       android:inputType="textEmailAddress"
       android:gravity="end"/>

<EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="@string/password"
        android:inputType="textPassword"
        android:gravity="end" />

Upvotes: 2

Views: 1721

Answers (2)

Navas pk
Navas pk

Reputation: 349

Try with this

<EditText
                android:id="@+id/username"
                style="@style/Widget.EditText"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:textAlignment="viewStart"
                android:hint="@string/username"
                android:layoutDirection="locale"
                android:padding="10dip"
                android:textDirection="locale" />
    <EditText
                android:id="@+id/password"
                style="@style/Widget.EditText"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:textAlignment="viewStart"
                android:hint="@string/password"
                android:layoutDirection="locale"
                android:padding="10dip"
                android:textDirection="locale" />

Upvotes: 0

ʍѳђઽ૯ท
ʍѳђઽ૯ท

Reputation: 16976

Try removing :

android:gravity="end"

In the first EditText. It should automatically make the text RTL if you already placed arabic values-ar in values folder.


Don't forget to add:

android:supportsRtl="true"

In AndroidManifest.xml also.

Update;

Didn’t get you at first but, add these:

android:layoutDirection="rtl"           
android:textDirection="rtl"

This will make the layout & text direction rtl and should help for the purpose.

Upvotes: 2

Related Questions