Simple date-time using xml

A simple way to display date-time using xml.

<android.widget.TextClock
android:id=”@+id/time”
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:timeZone=”GMT+0000″ <!–Greenwich –>
android:format24Hour=”k:mm”
android:format12Hour=”@null”
android:textAppearance=”?android:attr/textAppearanceMedium”
android:layout_centerVertical=”true”
android:layout_centerHorizontal=”true” />
Omit the timeZone to pick up local settings from phone.

This entry was posted in Android. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *