的DatePicker控件格式控件、格式、DatePicker

2023-09-13 00:48:46 作者:咱、拼了命珍惜迩

我已经定义的DatePicker的小部件XML布局如下:

I have defined a xml layout with the DatePicker widget as follows:

     <DatePicker 
        android:id="@+id/SelectDate"
        android:layout_marginTop="10dp"  
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content"
        android:gravity="center|center_horizontal|center_vertical">
    </DatePicker>

和它显示在 MM / DD / YYYY 格式如下:

我怎么能显示DatePicker的小部件(DD / MM / YYYY)的格式, 作为下面?

but how can I display the DatePicker widget in (dd/mm/yyyy) format, as below?

推荐答案

在选择器采取由用户选择的日期格式,这意味着你真的没有对其进行格式化,因为可能是用户enjoyes最看格式他用。

The picker take the date format chosen by the user, which means you don't really have to format it, as probably the user enjoyes the most to see the format he's used to.

我刚刚测试过的HelloDatePicker教程,并在我的手机,我有(日/月/年)格式的日期,所以选择器显示了相同的格式;在仿真器,我已经把日期为mm / dd / yyyy格式,所以选择器显示相同的。

I've just tested the HelloDatePicker tutorial and in my phone, I have the date in (dd/mm/yyyy) format, so the picker shows the same format; in emulator, I've put the date in mm/dd/yyyy format, so the picker displays the same.

根据这个回答有没有方法来设置显示格式。

According to this answer there is no method to set the display format.