本章節(jié)翻譯自《Beginning-Android-4-Application-Development》,如有翻譯不當(dāng)?shù)牡胤剑凑?qǐng)指出。
原書購(gòu)買地址 http://www.amazon.com/Beginning-Android-4-Application-Development/dp/1118199545/
AnalogClock視圖顯示了一個(gè)模擬的時(shí)鐘,其中有一個(gè)時(shí)針和一個(gè)分針。與其相對(duì)的是DigitalClock視圖,它可以顯示數(shù)字模擬時(shí)鐘。這兩個(gè)視圖只能顯示系統(tǒng)時(shí)間,不允許顯示一個(gè)特定時(shí)區(qū)的時(shí)間。因此,如果你想要顯示一個(gè)特定時(shí)區(qū)的時(shí)間,那么你就不得不去實(shí)現(xiàn)你自己的自定義控件了。
注:關(guān)于如何自定義控件,請(qǐng)查看如下網(wǎng)址。
http://developer.android.com/guide/topics/ui/custom-components.html
使用AnalogClock與DigitalClock是非常簡(jiǎn)單的。只要把它們聲明在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>

更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主
微信掃碼或搜索:z360901061

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