2

is there any way to show TextInputLayout in right to left mode ? i use TextInputLayout with below code but it is left to right.

<android.support.design.widget.TextInputLayout
    android:id="@+id/ttt"
    android:layout_width="300dp"
    android:layout_height="wrap_content"
    android:layout_centerVertical="true"
    android:layout_centerHorizontal="true">

<EditText
    android:layout_width="300dp"
    android:layout_height="55dp"
    android:id="@+id/editText"
    android:singleLine="true"
    android:hint="hint"/>

</android.support.design.widget.TextInputLayout>
mahdi
  • 16,257
  • 15
  • 52
  • 73
  • Make sure that you are on the latest edition of the library (should be 23.0.1, IIRC). According to [this issue](https://code.google.com/p/android/issues/detail?id=182155), there was an RTL issue with the hint that was fixed. If that is not the problem that you are seeing, you may wish to post some screenshots and otherwise compare your code with what is in that issue. – CommonsWare Sep 10 '15 at 23:26
  • It is a strange idea, but you're trying to change the locale for testing? – user2413972 Sep 10 '15 at 23:26
  • you can position the cursor on the right side but not sure what happens when you type -- http://stackoverflow.com/questions/7813310/how-do-i-position-the-cursor-on-the-right-in-edittext – Tasos Sep 10 '15 at 23:34
  • wow it works -- so add (android:ellipsize="end" android:gravity="right") to your edit text – Tasos Sep 10 '15 at 23:39
  • @Tasos it`s not working for me , i added this properties to my code but it`s not work – mahdi Sep 11 '15 at 08:49
  • sorry i thought you wanted the text to be right to to left. i put those settings in editText – Tasos Sep 11 '15 at 09:36
  • It seems that TextInputLayout doesn't support RTL for now. Have you found a solution? – Yev Kanivets Dec 22 '15 at 08:48

1 Answers1

4

Actually, you have the problem with wrong direction because of strings location has higher priority then gravity and textAlignment.

So to get it work you need:

  1. Create a localized string.xml in iw folder.
  2. Set gravity of EditText to start.
  3. Set textAlignment to viewStart.
Yev Kanivets
  • 1,780
  • 3
  • 22
  • 38