Read "Android from getting Started to mastering" (15)--Digital clock

Source: Internet
Author: User

Digital Clock (DigitalClock)

Java.lang.Object;
Android.view.View;
Android.widget.TextView;
Android.widget.DigitalClock;

DigitalClock class method


Watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqv/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/gravity /center ">

DigitalClock Demo sample

Full project:http://download.csdn.net/detail/sweetloveft/9413393

You just need to map it in XML! Note The Textclock override is used in the high version number

1.mainactivity.java

Package Com.sweetlover.activity;import Com.sweetlover.digitalclockdemo.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 "> <digitalclock android:id=" @+id/digitalclock1 " android:layout_width=" Wrap_content " android:layout_height= "Wrap_content" android:layout_gravity= "center" android:textsize= "30SP"/></ Linearlayout>

3.androidmanifest.xml

<manifest xmlns:android= "http://schemas.android.com/apk/res/android"    package= " Com.sweetlover.digitalclockdemo "    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" (15)--Digital clock

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.