Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cursor in EditText hint does not start from right for Arabic

I'm trying to make EditText with a hint text: In English "password" .. the cursor is correctly set to the left. But for Arabic for which the hint is "كلمه المرور" the cursor is always set to the left (the end of the hint) instead of the right.

<EditText
        android:id="@id/ETPass"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/etUsrName"
        android:layout_marginLeft="@dimen/_25sdp"
        android:layout_marginRight="@dimen/_25sdp"
        android:layout_marginTop="@dimen/_5sdp"
        android:background="@drawable/signup_edittext_input"
        android:ellipsize="start"
        android:gravity="center|right"
        android:hint="@string/Password"
        android:imeOptions="actionNext"
        android:inputType="textPassword"
        android:paddingRight="@dimen/_5sdp"
        android:singleLine="true"
        android:textColor="@color/orange"
        android:textColorHint="@color/orange" />

This happens only for android:inputType="textPassword" . Everything works fine for a normal text inputType.

like image 363
user3623824 Avatar asked May 26 '15 10:05

user3623824


People also ask

How do I change the cursor position in EditText?

Say in your xml's edittext section, add android:paddingLeft="100dp" This will move your start position of cursor 100dp right from left end. Same way, you can use android:paddingRight="100dp" This will move your end position of cursor 100dp left from right end.

How do I edit EditText Uneditable?

If you want your disabled EditText to look the same as your enabled one, you should use android:enabled="false" in combination with android:textColor="..." . Show activity on this post. Used this if you have an icon to be clickable, this works for me.

How do I scroll up layout when clicking on EditText?

try this android:windowSoftInputMode="adjustResize" in your activity in manifest file.


Video Answer


2 Answers

For Android 17 and higher(4.2.+) its working:

android:textAlignment="viewStart"
like image 91
Ravi Yadav Avatar answered Oct 17 '22 17:10

Ravi Yadav


Try:

android:textDirection="rtl"
like image 1
Kantesh Avatar answered Oct 17 '22 18:10

Kantesh