首页 > 解决方案 > 为什么在 ANDROID 中设置单个阿拉伯字符时,阿拉伯字符表现为单独的字符?

问题描述

我对此很陌生。但我确实按照一个例子来渲染彩色字母: https ://play.nativescript.org/?template=play-ng&id=ZaGBJr

<Label class="h1">
        <FormattedString>
            <Span text="صُ" color="#990000" class="quran"></Span>
            <Span text="مٌّۢ" color="#ffcc00" class="quran"></Span>
        </FormattedString>
</Label>

但是android和iOS之间的结果是不同的。我哪里做错了?

iOS(完美):

iOS

Android(分隔字符):

在此处输入图像描述

标签: androidnativescript

解决方案


哟只需要在两者之间添加ZWJ(零宽度连接器\u200D)。请参见下面的 hTML 示例:

<h1>
        <FormattedString>
        <Span style="color:#990000">صُ</Span><Span  style="color:#ffcc00">مٌّۢ</Span><br><br>
            <Span style="color:#990000" >صُ&#x200d;</Span><Span style="color:#ffcc00">مٌّۢ</Span>
        </FormattedString>
</h1>


推荐阅读