AnalogClock視圖顯示瞭一個模擬的時鐘,其中有一個時針和一個分針。與其相對的是DigitalClock視圖,它可以顯示數字模擬時鐘。這兩個視圖隻能顯示系統時間,不允許顯示一個特定時區的時間。因此,如果你想要顯示一個特定時區的時間,那麼你就不得不去實現你自己的自定義控件瞭。
註:關於如何自定義控件,請查看如下網址。
http://developer.android.com/guide/topics/ui/custom-components.html
使用AnalogClock與DigitalClock是非常簡單的。隻要把它們聲明在xml文件中就可以瞭。
[html]
<?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" >
<AnalogClock
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<DigitalClock
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>