Alex

Android software development engineer

Welcome to my web site


TextClock

目录

TextClock 格式化显示当前日期和时间。

TextClock 遵循 24 小时格式系统,提供两种格式化:

  • 24 小时制显示日期和时间
  • 12 小时制显示日期和时间

属性

android:format12Hour: 设置12小时制的格式

android:format24Hour: 设置24小时制的格式

android:timeZone: 指定要使用的时区,设置后忽略系统时间变化

常用方法

setFormat12Hour(CharSequence format):设置12小时制的格式

setFormat24Hour(CharSequence format):设置24小时制的格式

setTimeZone(String timeZone):设置指定的时区

getFormat12Hour():返回12小时制的格式

getFormat24Hour():返回24小时制的格式

getTimeZone():返回当前使用的时区

is24HourModeEnabled():当前系统是否使用 24 小时格式

示例

源码

打赏一个呗

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码支持
扫码打赏,你说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦