赞
踩
如果您的系统处于12小时模式,则不必编写子类来获得所需的内容.
JavaDocs说:
In 12-hour mode:
Use the value returned by getFormat12Hour() when non-null
Otherwise, use the value returned by getFormat24Hour() when non-null
Otherwise, use a default value appropriate for the user’s locale, such as HH:mm
因此,我希望其中的最后一行使getFormat12Hour()返回null,从而使用您的自定义getFormat24Hour()格式:
android:id="@+id/hk_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:timeZone="GMT+0800"
android:format24Hour="MMM dd, yyyy k:mm"
android:format12Hour="@null" />
(顺便说一下,正如其他人所说的那样,强制格式应该谨慎使用.如果你的用户需要一个24小时制的时钟,他们会在他们的系统偏好中指定这个.而且应用程序强制使用数字格式,颠倒的日期格式用户,如MM / dd / yyyy,邀请一星评级(在这种情况下,来自美国和菲律宾用户除外),所以你使用MMM是件好事!尽管使用getBestDateTimePattern()仍然会更好,不过,我相信,它需要继承TextClock.)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。