How to set Arabic text plus English text in EditText from right to left

I am setting below text in EditText as hint

مرحبا هذا هو الاختبار. Test

But this is shown below

Test مرحبا هذا هو الاختبار.

I want to set the hint as I gave the string in the hint.

      <EditText
            android:id="@+id/username"
            android:layout_width="0dip"
            android:layout_height="48dp"
            android:layout_marginRight="5dp"
            android:layout_weight="1"
            android:focusable="true"
            android:lines="1"
            android:hint="مرحبا هذا هو الاختبار. Test"
            android:singleLine="true"
            android:textColor="#000000"
            android:textSize="18sp" />

      

+3


source to share


4 answers


You cannot use multiple languages ​​in the same direction as Arabic rtl and English is ltr, so when you start Arabic correctly it jumps to the end of the line and finds English text, so it starts f English text and so it prints both english and arabic text in the user interface.



So, for your specific need, you need to use two different editors for Arabic and English, and you can put them in the same interface so that it looks like they are both written in the same editor.

0


source


all you need to just add



android:gravity="right"

      

0


source


Shouldn't that be at the beginning of this scenario? From the beginning, this is the end in Arabic. Also, you would not use the full stop at the beginning (end) of an Arabic sentence.

0


source


Customize the prompt text:

android:hint="@string/yourhintText"

      

-2


source







All Articles