Table Clock (AnalogClock)
Java.lang.Object;
Android.view.View;
Android.widget.AnalogClock;
AnalogClock class method
AnalogClock Example
Complete project: http://download.csdn.net/detail/sweetloveft/9416138
This program as long as the map can be, recall before the DigitalClock, and later verified that this kind of engineering is generally a map, not to self-painted words, need to do related rewriting of derived classes, which will be used to Canvas and other aspects of the content.
1.mainactivity.java
Package Com.sweetlover.activity;import Com.sweetlover.analogclockdemo.r;import Android.app.activity;import Android.os.bundle;public class Mainactivity extends Activity {@Overrideprotected void OnCreate (Bundle Savedinstancestate) {//TODO auto-generated method Stubsuper.oncreate (savedinstancestate); Setcontentview ( R.layout.activity_main);}}
2.activity_main.xml
<?xml version= "1.0" encoding= "Utf-8"? ><linearlayout xmlns:android= "http://schemas.android.com/apk/res/ Android " android:layout_width=" match_parent " android:layout_height=" match_parent " android:padding= "30DP" android:orientation= "vertical" > <analogclock android:id= "@+id/analogclock1" Android:layout_width= "Wrap_content" android:layout_height= "wrap_content" android:layout_gravity= " Center "/></linearlayout>
3.androidmanifest.xml
<manifest xmlns:android= "http://schemas.android.com/apk/res/android" package= " Com.sweetlover.analogclockdemo " android:versioncode=" 1 " android:versionname=" 1.0 "> <uses-sdk android:minsdkversion= "8" android:targetsdkversion= "/>" <application android: Allowbackup= "true" android:icon= "@drawable/ic_launcher" android:label= "@string/app_name" android: Theme= "@style/apptheme" > <activity android:name= "com.sweetlover.activity.MainActivity" > < intent-filter> <action android:name= "Android.intent.action.MAIN"/> <category android:name= "Android.intent.category.LAUNCHER"/> </intent-filter> </activity> </ Application></manifest>
Read "Android from getting Started to mastering" (16)--Table clock