I have been trying to get an answer to this question for quite a while. I also had a look at the following link: Android - DatePicker Widget Format. On my phone/ emulator (v 2.3.3) both the DatePicker widget and the dialog do not take the date format specified in settings (Settings->Date&Time->Select date format). They are always in the format "MM/dd/yyyy". The locale is set to English UK.
I get "d/MM/yyyy" when I read the settings with:
Settings.System.getString(getContentResolver(), Settings.System.DATE_FORMAT);
Does anybody have an idea about how to change the date format in a DatePicker view?
For example, android:layout_width="15dp" will set the width at a scalable value of 15. You can change 15 to whatever you want. If you want to set a specific pixel size, you can use, for example, 15px .
To override the DatePicker format the best bet would be to override one of its constructors with a slight edit to the original code. You can edit the ViewGroup in code for you but I'd seriously consider not doing it that way.
inflater.inflate(R.layout.date_picker, this, true);
with inflater.inflate(my.package.R.layout.localized_date_picker, this, true);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With