日本搞逼视频_黄色一级片免费在线观看_色99久久_性明星video另类hd_欧美77_综合在线视频

國內最全IT社區平臺 聯系我們 | 收藏本站
阿里云優惠2
您當前位置:首頁 > php開源 > 綜合技術 > Chronometer組件實現計時器小程序

Chronometer組件實現計時器小程序

來源:程序員人生   發布時間:2015-02-04 08:42:02 閱讀次數:3417次

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="復位" /> <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); // 設置要使用的布局管理器 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。"); } } }

運行效果以下:


生活不易,碼農辛苦
如果您覺得本網站對您的學習有所幫助,可以手機掃描二維碼進行捐贈
程序員人生
------分隔線----------------------------
分享到:
------分隔線----------------------------
關閉
程序員人生
主站蜘蛛池模板: 日本一区二区在线视频 | www.久久久 | 久久99精品国产91久久来源 | 最近中文字幕免费在线观看 | 第一av| 在线三区 | 热re99久久精品国产99热 | 中文字幕一区二区三区日韩精品 | 久久久久一区二区三区 | 在线成人www免费观看视频 | 国产一区二区三区在线免费观看 | 天天综合久久 | 亚洲香蕉影院 | 91区国产 | 国产精品久久久久一区二区三区共 | 国产精品国产三级国产a | 91av电影在线 | 国产精品久久久久国产a级 亚洲天堂偷拍 | 日韩一区二区视频 | 久久精品视频网站 | 国产精品久久久久久久久久 | 97成人超碰 | 欧美一区二区视频在线 | 中国一级片在线观看 | 欧美性大战久久久久久久蜜臀 | 成人欧美一区二区三区视频网页 | 免费黄网站 | www.欧美色图| 国产精品18久久久久久久久 | 欧美亚洲激情视频 | 黄色片网战 | 色中文字幕在线 | 国产欧美一区二区精品久导航 | 亚洲一级毛片 | 日韩在线观看网站 | 国产在线日韩 | 久久久久久久久久久久久91 | 中文无码日韩欧 | 99毛片| 在线国产一区 | 国产一区在线免费观看 |