Nur*_*din 3 android localization number-formatting
像这样东方阿拉伯数字 {\xd9\xa0\xd9\xa1\xd9\xa2\xd9\xa3\xd9\xa4\xd9\xa5\xd9\xa6\xd9\xa7\xd9\xa8\xd9\xa9} \n我
使用此方法可以更改应用程序语言,但它不能完全显示印地语数字
Locale Language = new Locale("ar"); \n Resources resources = context.getResources(); \n DisplayMetrics displayMetrics = resources.getDisplayMetrics(); \n Configuration conf = resources.getConfiguration(); \n conf.locale= Language; \n Language.setDefault(Language); \n conf.setLayoutDirection(Language); \n resources.updateConfiguration(conf, displayMetrics); \n
Run Code Online (Sandbox Code Playgroud)\n
与与 i18n 相关的所有内容一样,应用程序必须以允许本地化的方式编写。
例如,Integer.toString(i)
将始终使用数字 0-9。要获得本地化数字,您必须使用String.format("%d", i)
orNumberFormat.getInstance().format(i)
来代替。
归档时间: |
|
查看次数: |
2134 次 |
最近记录: |