Android : 连接和彩色的阿拉伯字母 [英] Android : Connected and colored arabic letters

查看:31
本文介绍了Android : 连接和彩色的阿拉伯字母的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在 android 视图(webview 或 textview)上显示连接的 AND 彩色阿拉伯字母.首先,我使用了没有颜色的 TextView,并且阿拉伯语显示正确.

I want to display connected AND colored arabic letters on a android view (webview or textview). First, I've used TextView without color and the arabic displayed correctly.

当我使用 spannableString 时,彩色字母与单词断开连接.

When I use spannableString, the colored letter disconnect from the word.

其次,我使用了带有 html 和字体标签的 WebView.我得到了同样的结果.

Secondly, I've used a WebView with html and font tags. I've got the same result.

每次我尝试为单词中的字母添加颜色时,该字母显示与单词断开连接.

Each time I try to put color on a letter in a word, this letter display disconnected from the word.

有没有人有解决这个问题的方法?

Does anyone has a solution to this problem ?

安卓版>4.0

推荐答案

Usama 和 danial 都有正确的想法,但他们没有解释得很清楚.如果您使用 unicode 阿拉伯字母 (0x06--),最新版本的 android 会在需要时自动将字母连接在一起,但这是在应用着色后完成的,着色会破坏字母之间的连接.

Usama and danial both have the right idea, but they have not explained it very clearly. If you use unicode arabic letters (0x06--), recent versions of android will automatically join the letters together where required, but this is done after applying the coloring, and the colouring breaks the connection between letters.

您必须将 unicode 阿拉伯字母 (0x06--) 转换为阿拉伯语演示文稿 B (0xFE--),并在转换时自己应用连接,然后在已连接的字母上使用设置颜色.Usams 建议的库看起来是从 unicode 阿拉伯语转换为表示 B 字符的好方法.

You have to convert the unicode arabic letters (0x06--) into Arabic presentation B (0xFE--), and apply the connections yourself as you convert, then use set the colours on the already-connected letters. The library that Usams suggests looks like a good way of converting from unicode arabic to presentation B characters.

这篇关于Android : 连接和彩色的阿拉伯字母的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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