在Android中专门为用户提供了两个时钟的组件AnalogClock与DigitalClock
在main.xml中
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:gravity="center_horizontal"
android:gravity="center_vertical">
<AnalogClock
android:layout_marginTop="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<DigitalClock
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>