android ForegroundColorSpan bug with arabic/persian hareka(اعراب)?

0

enter image description here

Above picture is the way an arabic word with hareka should look but after applying ForegroundColorSpan on the second letter(zamma), like below:

TextView textView = findViewById(R.id.simple_tv);
String text = "گُرگ";
SpannableString spann = new SpannableString(text);
spann.setSpan(new ForegroundColorSpan(0xFFFF0000), 1, 2, 0);
textView.setText(spann, TextView.BufferType.SPANNABLE);

the result I get is like below which changes the placement of that letter(zamma) and I couldn't figure out why and how to fix it, any ideas or hints is appreciated in advance

enter image description here

EDIT:

I just tried an alternative, setting html on textview but the result is exactly the same

string = "<font color='#FFFFFF'>This is my text </font>" + "<font color='#000000'> Another text </font>";
textView.setText(Html.fromHtml(string));
android
arabic
spannable
farsi
asked on Stack Overflow Aug 3, 2020 by Shaheen Zahedi • edited Aug 3, 2020 by Shaheen Zahedi

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0