TextClock
TextClock:
TextClock is the clock that shows the time or date in the text that you would like to define.
This is a class present in the Android framework where it is regularly used to display the current time or date in the context of the user interface.
Example:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".TextClockExample"
android:padding="16dp"
android:orientation="vertical"
android:gravity="center">
<TextClock
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@color/colorWhite"
android:textStyle="bold"
android:textSize="40sp"
android:format12Hour="hh:mm:ss a"
android:gravity="center"
android:background="@color/colorOrange"
/>
</LinearLayout>
Output