android&&DatePicker&&TimePicker
分类 java2011-11-2213:2676人阅读评论(0)收藏举报package com. l ianweijie.demo;import java.uti l .Calendar;import android.app.Activity;import android.app.DatePickerDialog;import android.app.TimePickerDialog;import android.os.Bundle;import android.view.View;import android.view.View.OnCl ickListener;import android.widget.Button;import android.widget.DatePicker;import android.widget.TextView;import android.widget.TimePicker;publ ic class MyprojectActivity extends Activity{
TextVi ew m_te xtVi ew;
DatePicker m_dataPicker;
TimePicker m_timePicker;
Button m_dpButton;
Button m_tpButton;
Calendarc;
@Overridepubl ic void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R. layout.main);c=Calendar.getInstance();m_textView=(TextView) findViewBy Id(R. id.textView1);m_dpButton=(Button) findViewById(R. id.button 1);m_tpButton=(Button) findViewById(R. id.button2);
m_dataPicker=(DatePicker)findViewById(R. id.DataPicker1);m_dataPicker. init(c.get(Calendar.YEAR),c.get(Calendar.MONTH),c
.get(Calendar.DAY_OF_MONTH),new DatePicker.OnDateChangedListener() {
@Overridepubl icvoid onDateChanged(DatePickerview,int year,int monthOfYear, int dayOfMonth) {
//C.set(year,monthOfYear,dauOfMonth)
}
});m_timePicker=(TimePicker)findViewById(R. id.TimePicker1);m_timePicker.setIs24HourView(true);m_timePicker
.setOnTimeChangedListener(new
TimePicker.OnTimeChangedListener() {
@Overridepubl icvoid onTimeChanged(TimePickerview,int hourOfDay,int minute) {
//c.set(year,month,day, hourOfDay,minute,second)
}
});m_dpButton.setOnCl ickListener(new OnCl ickListener() {
@Overridepubl icvoid onCl ick(Viewv) {new DatePickerDialog(MyprojectActivity.this, new
DatePickerDialog.OnDateSetListener() {
@Overridepubl ic void onDateSet(DatePickerview, intyear, int monthOfYear,int dayOfMonth) {
//TODO Auto-generated method stub
}
},c.get(Calendar.YEAR),c.get(Calendar.MONTH),c.get(Calendar.DAY_OF_MONTH)).show();}
});m_tpButton.setOnCl ickListener(new OnCl ickListener() {@Overridepubl icvoid onCl ick(Viewv) {new TimePickerDialog(MyprojectActivity.this, newTimePickerDialog.OnTimeSetListener() {
@Overridepubl ic void onTimeSet(TimePickerview, inthourOfDay, int minute) {
//TODO Auto-generated method stub
}
},c.get(Calendar.HOUR_OF_DAY),c.get(Calendar.MINUTE),true).show();
}
});
}
}
<?xml version="1 .0"encoding="utf-8"?>
<LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"android: layout_width="fi l l_parent"android: layout_height="fi l l_parent"android:orientation="vertical">
<TextVi ewandroid: id="@+id/textView1"android: layout_width="fi l l_parent"android: layout_height="wrap_content"android:text="@string/hel lo" />
<DatePickerandroid: id="@+id/DataPicker1"android: layout_width="fi l l_parent"android: layout_height="wrap_content">
</DatePicker>
<TimePickerandroid: id="@+id/TimePicker1"android: layout_width="fi l l_parent"android: layout_height="wrap_content">
</TimePicker>
<Buttonandroid: id="@+id/button 1"android: layout_width="fi l l_parent"android: layout_height="wrap_content"and roid:text="设置日期" />
<Buttona n d ro i d: i d="@+i d/b utto n2"
android: layout_width="fi l l_parent"android: layout_height="wrap_content"and roid:text="设置时间" />
</LinearLayout>
virmach送来了夏季促销,价格低到爆炸,而且在低价的基础上还搞首年8折,也就是说VPS低至7.2美元/年。不过,这里有一点要说明:你所购买的当前的VPS将会在09/30/2021 ~ 04/30/2022进行服务器转移,而且IP还会改变,当前的Intel平台会换成AMD平台,机房也会变动(目前来看以后会从colocrossing切换到INAP和Psychz),采取的是就近原则,原来的水牛城可能...
Friendhosting商家在前面的篇幅中也又陆续介绍到,是一家保加利亚主机商,主要提供销售VPS和独立服务器出租业务,数据中心分布在:荷兰、保加利亚、立陶宛、捷克、乌克兰和美国洛杉矶等。这不近期黑色星期五活动,商家也有推出了黑五优惠,VPS全场一次性45折,虚拟主机4折,全球多机房可选,老用户续费可获9折加送1个月使用时长,VDS折后最低仅€14.53/年,有需要的可以看看。Friendhos...
ReliableSite怎么样?ReliableSite好不好。ReliableSite是一家成立于2006年的老牌美国商家,主要经营美国独立服务器租赁,数据中心位于:洛杉矶、迈阿密、纽约,带宽1Gbps起步,花19美元/月即可升级到10Gbps带宽,月流量150T足够各种业务场景使用,且免费提供20Gbps DDoS防护。当前商家有几款大硬盘美国独服,地点位于美国洛杉矶或纽约机房,机器配置很具有...