首页 > 解决方案 > 如何在 Android 中使用带有英文单词的 ar-rAE?

问题描述

我有资源R.string.word

<string name="word">%2$s %1$s</string>

此字符串资源用于显示 TextView(Ej. 12343 ترتيب),这与阿拉伯语的设备完美配合。但是,如果我有阿拉伯语的设备并且单词是另一种语言(如英语),则应用程序会更改订单 Ej.(订单 12343)。我尝试删除英文的默认字符串资源但不起作用,我尝试使用自定义区域设置强制使用(ar-rAE)但也不起作用。

Resources res = getResources();
Configuration conf = res.getConfiguration();
Locale savedLocale = conf.locale;
conf.locale = desiredLocale; // whatever you want here
res.updateConfiguration(conf, null);

我不完全确定 Android 是否检测到这些词并忽略设备中的语言,使用这些词来定义要使用的 R.string。

标签: androidxmlandroid-studiomobilearabic

解决方案


在此处查看有关 Android 文档中 RTL 的更多信息:支持布局镜像


推荐阅读