Home » Android » textview not right to left although right to left device

textview not right to left although right to left device

Posted by: admin November 1, 2017 Leave a comment

Questions:

I’m building an app that will work both for RTL and for LTR on local direction , i work with a RTL device (HEBREW) and all views are RTL ok. but on another device a bit newer all views that’s text is in Hebrew are right to left but in English they are left to right they supposed to be right to left even if they are in English , already tested on 2 newer phones and yeah this problem again.

please help.

Answers:

You can change gravity in XML:

<TextView android:width="wrap_content"
          android:height="wrap_content"
          android:text="example"
          android:gravity="right"/>

You can also change it in code:

textView.setGravity(Gravity.RIGHT);

Questions:
Answers:

While working with an app that supports both RTL and LTR, Use values for gravity as START and END