欧美一级特黄大片做受成人-亚洲成人一区二区电影-激情熟女一区二区三区-日韩专区欧美专区国产专区

Android倒計(jì)時(shí)

感謝極客學(xué)院的視頻

創(chuàng)新互聯(lián)專業(yè)為企業(yè)提供邵陽(yáng)網(wǎng)站建設(shè)、邵陽(yáng)做網(wǎng)站、邵陽(yáng)網(wǎng)站設(shè)計(jì)、邵陽(yáng)網(wǎng)站制作等企業(yè)網(wǎng)站建設(shè)、網(wǎng)頁(yè)設(shè)計(jì)與制作、邵陽(yáng)企業(yè)網(wǎng)站模板建站服務(wù),十年邵陽(yáng)做網(wǎng)站經(jīng)驗(yàn),不只是建網(wǎng)站,更提供有價(jià)值的思路和整體網(wǎng)絡(luò)服務(wù)。

布局文件:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="com.example.timer.MainActivity" >

    <EditText 
        android:id="@+id/inputtime"
        android:layout_height="wrap_content"
        android:layout_width="fill_parent"
        
        />
    
    <Button 
        android:id="@+id/settime"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="set"
        />
    
    <TextView
        android:id="@+id/showtime"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        />
    
    <LinearLayout 
        android:orientation="horizontal"
        android:layout_height="wrap_content"
        android:layout_width="fill_parent"
        >
        
        <Button
            android:id="@+id/starttime"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="start"
            />
        
        <Button
            android:id="@+id/endtime"
            android:layout_height="wrap_content"
            android:layout_width="wrap_content"
            android:text="end"
            />
        
    </LinearLayout>

</LinearLayout>

下面是Java文件:

package com.example.timer;

import java.util.Timer;
import java.util.TimerTask;

import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.v7.app.ActionBarActivity;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

public class MainActivity extends ActionBarActivity implements OnClickListener{
	
	EditText inputtime;
	Button settime,starttime,endtime;
	TextView showtime;
	private int i = 0 ;
	Timer timer = null;
	TimerTask task = null;
	
	private void init(){
		inputtime = (EditText)findViewById(R.id.inputtime);
		settime = (Button)findViewById(R.id.settime);
		starttime = (Button)findViewById(R.id.starttime);
		endtime = (Button)findViewById(R.id.endtime);
		showtime = (TextView)findViewById(R.id.showtime);
		settime.setOnClickListener(this);
		starttime.setOnClickListener(this);
		endtime.setOnClickListener(this);
	}

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		init();
	}

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		switch(v.getId()){
		case R.id.settime:
			showtime.setText(inputtime.getText().toString());
			i = Integer.parseInt(inputtime.getText().toString());
			break;
		case R.id.starttime:
			startTime();
			break;
		case R.id.endtime:
			endTime();
			break;
		}
	}
	private Handler mHandler = new Handler(){
		public void handleMessage(Message msg){
			showtime.setText(msg.arg1+"");
			startTime();
		}
	};
	
	public void startTime(){
		timer = new Timer();
		task = new TimerTask(){

			@Override
			public void run() {
				// TODO Auto-generated method stub
				i--;
				Message message = mHandler.obtainMessage();
				message.arg1 = i;
				mHandler.sendMessage(message);
			}
			
		};
		timer.schedule(task,1000);//第二個(gè)參數(shù)表示以1000毫秒計(jì)時(shí)
	}

	public void endTime(){
		timer.cancel();
	}
}
  1. 設(shè)置監(jiān)聽(tīng)可以implements OnClickListener接口然后重寫onClick(View v)方法,然后給組件widget.setOnClickListener(this);然后在onClick()方法里抓取v.getId()

  2. TextView.setText(xxxx)里xxxx必須是字符串類型否則崩潰,可以用xxx.toString()也可以xxx+""自動(dòng)轉(zhuǎn)化

新聞標(biāo)題:Android倒計(jì)時(shí)
網(wǎng)站地址:http://aaarwkj.com/article46/gpideg.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供企業(yè)網(wǎng)站制作、網(wǎng)站營(yíng)銷、電子商務(wù)網(wǎng)站建設(shè)、小程序開(kāi)發(fā)、

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

成都網(wǎng)頁(yè)設(shè)計(jì)公司
亚洲熟妇精品一区二区三区| 女同同性av观看免费| 欧美日韩国产天堂一区| 九九久久亚洲av成人乱片| 国内成人午夜激情视频| 婷婷人妻中文字幕在线| 国产黄色一区二区三区,| 91久久亚洲综合精品成人| 美女午夜福利精品视频| 天天操夜夜操狠狠操91| 久久精品视频亚洲一级| 成人精品午夜福利视频| 九九热在线免费观看精品视频| 国产真人作爱视频免费| 人妻日韩精品综合一二三四| 日韩x级av免费在线观看| 国产成人亚洲综合色影视| 成人黄网站色大片免费| 精品久久久噜噜噜久久| 精品人妻二区中文字幕| 色婷婷国产精品高潮呻吟| 成人性生交免大片免费| 亚洲伦理第一页中文字幕| 情五月激情亚洲丁香佳色| 丰满少妇在线观看网站| 国产成人久久精品二区三区| 91中文字幕在线一区| 邻居少妇扒开腿让我爽了一夜| 久久久久久精品国产免费| 欧美日韩中文字幕精品视频| 中文乱幕亚洲无套内射 | 亚洲精品日韩一区二区| 国产白丝扒开做爽爽爽网站| 国产成人免费视频一区| 和富婆啪啪一区二区免费看| 午夜福利视频在线观看| 男人的天堂在线观看黄片| 91久久精品91久久性色| 亚洲欧美成人免费视频| 亚洲综合国产中文字幕| 无人视频在线观看高清91|