当前位置:操作系统 > 安卓/Android >>

Android 程式开发:(十六)其他视图 —— 16.1 AnalogClock和DigitalClock

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> 
 
补充:移动开发 , Android ,
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,