如何防止希伯来语和阿拉伯语的自动从右到左的文本方向? [英] How to prevent automatic right-to-left text direction for Hebrew and Arabic?

查看:32
本文介绍了如何防止希伯来语和阿拉伯语的自动从右到左的文本方向?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 TextView 中,当文本以希伯来字母开头时,整个文本以 RTL 模式显示.

In a TextView, when a text starts with a Hebrew letter, the entire text is shown in RTL mode.

问题在于,在我的例子中,只有第一个单词是希伯来语,而整个句子都是英语,所以不是

The problem is that in my case only the first word is in Hebrew, while the entire sentence is in English, so instead of

 דני went to school

用户看到

                                                  went to school דני

(英文阅读时,第一个词在句尾)

(the first word is in the end of the sentence, when reading in English)

如何防止这种情况发生并强制文本从左侧开始?

How can I prevent this from happening and force the text to start from the left?

推荐答案

Unicode 字符是 intrisectly LTR 或 RTL.在大多数情况下,整个文本的方向都是从第一个字符开始的.希伯来字符是 RTL.

Unicode characters are intrisectly LTR or RTL. In most situations, the whole text takes its orientation from the first character. Hebrew character are RTL.

参见http://en.wikipedia.org/wiki/Bi-directional_text

您的文本以 RTL 字符开头,因此被视为 RTL.您可以使用 left-to-right mark, "u200E" 强制将其视为 LTR.

Your text starts with a RTL character, and is therefore considered RTL. You can force it to be seen as LTR by using the left-to-right mark, "u200E".

以这个特殊字符开始你的文本将告诉布局系统整个文本的明确方向.不过,RTL 部分仍将被视为此类,因为字符是明确的 RTL.

Starting your text with this special character will tell the layout system the explicit orientation of the whole text. RTL sections will still be considered as such, though, because the characters are explicitly RTL.

例如,数字不是一个强有力的指标,因此不会影响它们所在部分的方向.因此,不同方向的部分之间的数字可能是一个问题,可能需要明确的指示.

Numbers, for example, are not a strong indicator, and therefore don't affect the direction of the section they are placed in. Therefore, numbers between section of different direction can be a problem, and may need explicit indication.

这篇关于如何防止希伯来语和阿拉伯语的自动从右到左的文本方向?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆