您的位置:首页 > 移动开发 > Android开发

Android7.0中文文档(API)-- TextClock

2017-06-12 23:47 911 查看

完整内容,请查看:http://www.zhdoc.net/android/reference/android/widget/TextClock.html

TextClock

public class TextClock

extends

TextView


java.lang.Object
   ↳android.view.View
    ↳android.widget.TextView
     ↳android.widget.TextClock
TextClock
can display the current date and/or time as a formatted string.
TextClock
以一个格式化的字符串来显示当前的日期和/或时间。

This view honors the 24-hour format system setting. As such, it is possible and recommended to provide two different formatting patterns: one to display the date/time in 24-hour mode and one to display the date/time in 12-hour mode. Most callers will want
to use the defaults, though, which will be appropriate for the user's locale.

此视图支持24小时格式的系统设置。因此,建议提供两种不同的格式模式:一种是24小时模式显示日期/时间,另一种是12小时模式显示日期/时间。不过,大多数调用者都会使用默认值,有用户的区域设置来决定显示格式。

It is possible to determine whether the system is currently in 24-hour mode by calling
is24HourModeEnabled()
.

可以通过调用
is24HourModeEnabled()
来确定系统当前是否处于24小时模式下。

The rules used by this widget to decide how to format the date and time are the following:

决定这个控件使用何种格式化日期和时间的规则如下:

24小时模式:
使用
getFormat24Hour()
返回的非空值
否则,使用
getFormat12Hour()
返回的非空值
否则使用用户的区域设置的默认值,如:
h:mm a


12小时模式:
使用
getFormat12Hour()
返回的非空值
否则,使用
getFormat24Hour()
返回的非空值
否则使用用户的区域设置的默认值,如:
HH:mm


The
CharSequence
instances used as formatting patterns when calling either
setFormat24Hour(CharSequence)
or
setFormat12Hour(CharSequence)
can contain styling information. To do so, use a
Spanned
object. Note that if you customize these strings, it is your responsibility to supply strings appropriate for formatting dates and/or times in
the user's locale.

当调用
setFormat24Hour(CharSequence)
setFormat12Hour(CharSequence)
可以包含显示的样式信息,其中
CharSequence
对象参数用于格式化模式。因此,需要一个
Spanned
对象。请注意,你如果自定义了这些字符串,则你有责任为用户区域设置中的格式化的日期和/或事件提供合适的字符串。

摘要

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息