Android 中 RTL 语言的问题
我在 TextView 中使用从右到左的语言时遇到问题。当我用阿拉伯语书写时,字符是分开出现的。我该如何解决这个问题?
I have a problem with right-to-left languages in TextView. When I write in Arabic, the characters appear separately. How can I solve this problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为没有令人鼓舞的答案。有两个问题:字体和文本布局。我相信 Android 中的字体没有附带阿拉伯连字和字母形状的表格。此外,据我所知,布局引擎(android.text.Layout 和相关类)不知道如何正确处理双向文本。虽然这据说正在开发中,但我的猜测是,Android 版本要正确处理 RTL 语言还需要一段时间,而且在相当一部分实际设备会这样做之前甚至需要更长的时间。
I think there is no encouraging answer. There are two problems: fonts and text layout. I believe that the fonts in Android don't come with tables for Arabic ligatures and letter shaping. Furthermore, as far as I can tell, the layout engine (android.text.Layout and related classes) do not know know how to handle bidirectional text properly. Although this is supposedly in the works, my guess is that it will be some time before an Android release handles rtl languages properly, and even more time before a significant fraction of actual devices will do so.
您应该获得良好的阿拉伯语字体并使用reshaper。阿拉伯语重塑器的链接阿拉伯重塑器
You should get good arabic font and use reshaper.Link for arabic reshaper Arabic reshaper