本章節翻譯自《Beginning-Android-4-Application-Development》,如有翻譯不當的地方,敬請指出。
原書購買地址 http://www.amazon.com/Beginning-Android-4-Application-Development/dp/1118199545/
AnalogClock視圖顯示了一個模擬的時鐘,其中有一個時針和一個分針。與其相對的是DigitalClock視圖,它可以顯示數字模擬時鐘。這兩個視圖只能顯示系統時間,不允許顯示一個特定時區的時間。因此,如果你想要顯示一個特定時區的時間,那么你就不得不去實現你自己的自定義控件了。
注:關于如何自定義控件,請查看如下網址。
http://developer.android.com/guide/topics/ui/custom-components.html
使用AnalogClock與DigitalClock是非常簡單的。只要把它們聲明在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" > <AnalogClock android:layout_width="wrap_content" android:layout_height="wrap_content" /> <DigitalClock android:layout_width="wrap_content" android:layout_height="wrap_content" /> </LinearLayout>

更多文章、技術交流、商務合作、聯系博主
微信掃碼或搜索:z360901061

微信掃一掃加我為好友
QQ號聯系: 360901061
您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。
【本文對您有幫助就好】元
