多多色-多人伦交性欧美在线观看-多人伦精品一区二区三区视频-多色视频-免费黄色视屏网站-免费黄色在线

國內(nèi)最全IT社區(qū)平臺 聯(lián)系我們 | 收藏本站
阿里云優(yōu)惠2
您當前位置:首頁 > php開源 > 綜合技術(shù) > Chronometer組件實現(xiàn)計時器小程序

Chronometer組件實現(xiàn)計時器小程序

來源:程序員人生   發(fā)布時間:2015-02-04 08:42:02 閱讀次數(shù):3413次

main.xml代碼以下:

<?xml version="1.0" encoding="utf⑻"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <Chronometer android:id="@+id/myChronometer" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <LinearLayout android:orientation="horizontal" android:layout_width="wrap_content" android:layout_height="wrap_content" > <Button android:id="@+id/btnStart" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="開始計時" /> <Button android:id="@+id/btnStop" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="停止計時" /> <Button android:id="@+id/btnBase" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="復(fù)位" /> <Button android:id="@+id/btnFormat" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="格式化顯示" /> </LinearLayout> </LinearLayout>

.java代碼以下:

package org.lxh.demo; import android.app.Activity; import android.os.Bundle; import android.os.SystemClock; import android.view.View; import android.view.View.OnClickListener; import android.view.View.OnFocusChangeListener; import android.widget.Button; import android.widget.Chronometer; import android.widget.EditText; import android.widget.TextView; public class Hello extends Activity { private Chronometer myChronometer=null; private Button btnStart=null; private Button btnStop=null; private Button btnBase=null; private Button btnFormat=null; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // 生命周期方法 super.setContentView(R.layout.main); // 設(shè)置要使用的布局管理器 this.myChronometer=(Chronometer)super.findViewById(R.id.myChronometer); this.btnStart=(Button)super.findViewById(R.id.btnStart); this.btnStop=(Button)super.findViewById(R.id.btnStop); this.btnBase=(Button)super.findViewById(R.id.btnBase); this.btnFormat=(Button)super.findViewById(R.id.btnFormat); this.btnStart.setOnClickListener(new OnClickListenerStart()); this.btnStop.setOnClickListener(new OnClickListenerStop()); this.btnBase.setOnClickListener(new OnClickListenerBase()); this.btnFormat.setOnClickListener(new OnClickListenerFormat()); } private class OnClickListenerStart implements OnClickListener{ public void onClick(View arg0) { Hello.this.myChronometer.start(); } } private class OnClickListenerStop implements OnClickListener{ public void onClick(View arg0) { Hello.this.myChronometer.stop(); } } private class OnClickListenerBase implements OnClickListener{ public void onClick(View arg0) { Hello.this.myChronometer.setBase(SystemClock.elapsedRealtime()); } } private class OnClickListenerFormat implements OnClickListener{ public void onClick(View arg0) { Hello.this.myChronometer.setFormat("新的顯示格式:%s。"); } } }

運行效果以下:


生活不易,碼農(nóng)辛苦
如果您覺得本網(wǎng)站對您的學(xué)習(xí)有所幫助,可以手機掃描二維碼進行捐贈
程序員人生
------分隔線----------------------------
分享到:
------分隔線----------------------------
關(guān)閉
程序員人生
主站蜘蛛池模板: 波多野结衣中文字幕一区二区三区 | 亚洲一区综合 | 黄 色 免 费 网站在线观看 | 久草综合网 | 亚洲精品国产一区二区在线 | 国产农村女人一级毛片了 | 91亚洲国产成人精品性色 | 中文综合| 日本一区二区三区四区不卡 | 日韩一区国产二区欧美三区 | 亚洲va乱码一区二区三区 | 性综合网| 欧美精品一区二区三区在线 | 亚洲大成色www永久网 | 手机看片日韩日韩韩 | 91久久精一区二区三区大全 | 欧美在线暴力性xxxx | 在线精品日韩一区二区三区 | 日本一区二区高清不卡 | 日本一级黄色毛片 | 欧美黄色片在线观看 | 国产人伦视频在线观看 | 性色生活免费看性大片 | 欧美黑人极品hdxxx | 日本一道dvd在线中文字幕 | 亚洲精品久久久午夜伊人 | 欧美亚洲日本一区 | 欧美18videosex性视频 | 性欧美videofree高 | 图片区小说区欧洲区 | 一级做a爰片欧美aaaa | 日韩理论片在线看免费观看 | 国产嫩草影院精品免费网址 | 精品一区二区三区高清免费不卡 | 网友自拍区一区二区三区 | 国内精品久久久久久网站 | 亚洲综合久久久 | 欧美大片天天免费看视频 | 91精品一区二区三区久久久久 | 国产成人精品免费视频大全办公室 | 亚洲欧美另类色妞网站 |