的DatePicker控件格式 [英] DatePicker Widget Format

查看:111
本文介绍了的DatePicker控件格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经定义的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.

这篇关于的DatePicker控件格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆