How to localize Android DatePicker?

 ̄綄美尐妖づ 提交于 2019-12-13 15:55:09

问题


I put the DatePicker on my Activity. Everytime I launch my app I see english version of date in the DatePicker widget: Oct 15 2012. But I want to have a local version of date (russian) when I start my Activity. I've tried to define the locale before UI initialization. But it doesn't help. Is there any possibility to make it without extending DatePicker class?


回答1:


In fact there is no need to override this class. But when I started to do it, I found info about special method "reorderpickers" which is specially designed to localize datepicker (automatically). My mistake was in setting Locale to English in the previous activity (to define English locale for password). That's why the standard method didn't work. So anybody who has the same problem check your code whether you have changed Locale.




回答2:


You should create your custom datepickerdialog. For make this, that link help you;

http://coffeebreak.hiq.se/2011/09/09/fixing-androids-datepickerdialog/




回答3:


Additional information for DataPicker and application locale you can find here



来源:https://stackoverflow.com/questions/12992765/how-to-localize-android-datepicker

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!