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

来源:互联网 发布:扫码抵扣软件 编辑:程序博客网 时间:2024/05/18 06:50

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

TextClock

public class TextClock
extendsTextView

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 callingis24HourModeEnabled().
可以通过调用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 eithersetFormat24Hour(CharSequence) orsetFormat12Hour(CharSequence) can contain styling information. To do so, use aSpanned 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对象。请注意,你如果自定义了这些字符串,则你有责任为用户区域设置中的格式化的日期和/或事件提供合适的字符串。

摘要


原创粉丝点击