[关闭]
@Allen-miss 2017-06-01T09:21:38.000000Z 字数 490 阅读 1324

TextClock时间显示控件

TextClock 时间


Android 时间显示控件 TextClock

TextClock可用作显示时间,API>=17,用来替代DigitalClock。
系统设置以24小时格式的时候使用这个format

  1. android:format24Hour="HH:mm"

系统设置以12小时显示的时候使用这个format

  1. android:format12Hour=”hh:mm

一些format

  1. MM 6
  2. MMM 6
  3. MMMM 六月
  4. EE 周六
  5. EEEE 星期六
  6. aa 上午/下午
  7. HH 24小时制
  8. hh 12小时制
  9. dd
  10. yyyy 年份

示例

  1. <TextClock
  2. android:id="@+id/textClock"
  3. android:layout_width="wrap_content"
  4. android:layout_height="wrap_content"
  5. android:format24Hour="HH:mm\r\nMM月dd日 EEEE"
  6. android:format12Hour="hh:mm\r\nMM月dd日 EEEE" />

显示效果

  1. 11:21
  2. 0601 星期四

TextClock Developers

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注