Android:如何为整个应用程序将数字格式更改为印地语格式(东方阿拉伯数字)?

时间:2017-03-22 09:07:13

标签: android localization number-formatting

像东方阿拉伯数字{0123456789}一样 我使用此方法更改应用程序语言,但它不能完全显示印地语数字

    Locale Language = new Locale("ar");    
    Resources resources = context.getResources();    
    DisplayMetrics displayMetrics = resources.getDisplayMetrics();   
    Configuration conf = resources.getConfiguration();   
    conf.locale= Language;   
    Language.setDefault(Language);   
    conf.setLayoutDirection(Language);   
    resources.updateConfiguration(conf, displayMetrics);   

1 个答案:

答案 0 :(得分:2)

与i18n相关的所有内容一样,应用必须以允许本地化的方式编写。

例如,Integer.toString(i)将始终使用数字0-9。要获取本地化数字,您必须使用String.format("%d", i)NumberFormat.getInstance().format(i)