Android Guides | Samples

Android.Widget.TextClock Class

See Also: TextClock

Syntax

[Android.Runtime.Register("android/widget/TextClock", DoNotGenerateAcw=true)]
public class TextClock : TextView

Remarks

TextClock can display the current date and/or time as a formatted string.

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.

It is possible to determine whether the system is currently in 24-hour mode by calling TextClock.Is24HourModeEnabled.

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

The ICharSequence instances used as formatting patterns when calling either TextClock.Format24HourFormatted or TextClock.Format12HourFormatted can contain styling information. To do so, use a ISpanned 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.

[Android Documentation]

Requirements

Namespace: Android.Widget
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 17

The members of Android.Widget.TextClock are listed below.

See Also: TextView

Public Constructors

Creates a new clock using the default patterns for the current locale.
Creates a new clock inflated from XML.
Creates a new clock inflated from XML.

Protected Constructors

A constructor used when creating managed representations of JNI objects; called by the runtime.

Public Properties

[read-only]
static
DefaultFormat12HourICharSequence. The default formatting pattern in 12-hour mode.
[read-only]
static
DefaultFormat24HourICharSequence. The default formatting pattern in 24-hour mode.
Format12HourString.
Format12HourFormattedICharSequence. Returns the formatting pattern used to display the date and/or time in 12-hour mode.
Format24HourString.
Format24HourFormattedICharSequence. Returns the formatting pattern used to display the date and/or time in 24-hour mode.
TimeZoneString. Indicates which time zone is currently used by this view.

Protected Properties

[read-only]
override
ThresholdClassIntPtr. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.
[read-only]
override
ThresholdTypeType. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Public Methods

Is24HourModeEnabled() : Boolean
Indicates whether the system is currently using the 24-hour mode.