Android 带不同颜色的阿拉伯文字母

Android 带不同颜色的阿拉伯文字母,android,Android,你好 我想要一个带字符串的android阿拉伯语文本视图 我想要红色的َُِو… 我试过这个方法,但不管用** TextView txt=(TextView)findViewById(R.id.txt); 字符串mainText=“َدَقَاله”; 字符串fatha=“َ”; 字符串htmlText=mainText.replaceAll(fatha,\u064F”); txt.setText(Html.fromHtml(htmlText)); 请帮帮我 在res下创建一个新文件夹,将其命

你好 我想要一个带字符串的android阿拉伯语文本视图 我想要红色的َُِو… 我试过这个方法,但不管用**

TextView txt=(TextView)findViewById(R.id.txt);
字符串mainText=“َدَقَاله”;
字符串fatha=“َ”;
字符串htmlText=mainText.replaceAll(fatha,\u064F”);
txt.setText(Html.fromHtml(htmlText));
请帮帮我


在res下创建一个新文件夹,将其命名为values ar并在其中创建strings.xml

添加任何你想要的单词,比如

<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="tt">صَدَقَ الله</string>
</resources>
现在按名称调用该字符串。
希望这有帮助

是的,我在发布之前就试过了。告诉我你是怎么做到的!
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="tt">صَدَقَ الله</string>
</resources>
Locale locale = new Locale("ar");
Locale.setDefault(locale);
Configuration config = new Configuration();
config.locale = locale;
getApplicationContext().getResources().updateConfiguration(config, null);