In my multi-lingual app, I handle text direction of a TextView based on the first character to be either RTL or LTR. Then the gravity would be set accordingly, too. What I want is different lines of a single TextView to have their own text directions and/or gravity.
How should I achieve this?
Update:
As babadaba answered, TEXT_DIRECTION_ANY_RTL does exactly like what I want. Here is the explanation in comments:
Text direction is using "any-RTL" algorithm. The paragraph direction is RTL if it contains any strong RTL character, otherwise it is LTR if it contains any strong LTR characters. If there are neither, the paragraph direction is the view's resolved layout direction.
Now, the question is how to implement ANY_RTL in API levels older that 17 ?