DatePicker及其监听
xml文件:
<DatePicker
android:id="@+id/datep"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
java代码:
TextView textview2;
DatePicker datep;
Calendar calendar=Calendar.getInstance();
/* (非 Javadoc)
* @see android.app.Activity#onCreate(android.os.Bundle)
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO 自动生成的方法存根
super.onCreate(savedInstanceState);
setContentView(R.layout.n_layout);
datep=(DatePicker)findViewById(R.id.datep);
textview2=(TextView)findViewById(R.id.date);
int year=calendar.get(Calendar.YEAR);
int month=calendar.get(Calendar.MONTH);
int day=calendar.get(Calendar.DAY_OF_MONTH);
datep.init(year, month, day, new OnDateChangedListener(){
@Override
public void onDateChanged(DatePicker datep, int year, int month,
int day) {
// TODO 自动生成的方法存根
textview2.setText("You select date is"+year+"year"+month+"month"+day+"day");
}
});
OK。
DatePicker及其监听的更多相关文章
- Android监听事件
ListView事件监听: setOnItemSelectedListener 鼠标滚动时触发 setOnItemClickListener 点击时触发 EditText事件监听: setOnKeyL ...
- Android开发之基于监听的事件处理
在Android 应用开发过程中,常用监听事件如下:(1) ListView事件监听setOn ItemSelectedListener:鼠标滚动时触发setOnItemClickListener: ...
- Vue引用第三方datepicker插件无法监听datepicker输入框的值
一.背景 在Vue项目中使用了第三方的datepicker插件,在选择日期后vue无法检测到datepicker输入框的变化 <label class="fl">日期: ...
- datePicker 及 timePicker Diolage弹出对话框式 比较好看的 监听事件
DatePickerDialog 的监听 new DatePickerDialog(this, new DatePickerDialog.OnDateSetListener() { @Override ...
- datePicker 及 timePicker 监听事件 获取用户选择 年月日分秒信息
public class MainActivity extends AppCompatActivity { private TimePicker timePicker; private DatePic ...
- Android——监听事件总结
各种监听事件 1.按钮 Button(1)点击监听 btn_1.setOnClickListener(new View.OnClickListener() { (2)长按监听 btn_1.setOnL ...
- dwz监听日期变化,dwz日期控件onchange不起作用,dwz框架时间控件不支持onchange事件
转载自:http://blog.csdn.net/sp308036654/article/details/50638348 <input type="text" class= ...
- iview中render函数监听事件
iview的table中添加datepicker在组件中嵌套组件,如果需要监听子组件的自定义事件,应该使用render中的on:{ 'on-change' () => { console.log ...
- 学习ASP.NET Core, 怎能不了解请求处理管道[3]: 自定义一个服务器感受一下管道是如何监听、接收和响应请求的
我们在<服务器在管道中的"龙头"地位>中对ASP.NET Core默认提供的具有跨平台能力的KestrelServer进行了介绍,为了让读者朋友们对管道中的服务器具有更 ...
随机推荐
- Apache
一.简介 Apache是世界使用排名第一的Web服务器软件.它可以运行在几乎所有广泛使用的计算机平台上,由于其跨平台和安全性被广泛使用,是最流行的Web服务器端软件之一.它快速.可靠并且可通过简单的A ...
- [转]jquery开发自定义的插件总结
本文转自:http://www.cnblogs.com/Jimmy009/archive/2013/01/17/jquery%E6%8F%92%E4%BB%B6.html 前几天在玩jquery,今天 ...
- 32-bit Assembly on x86_64 Linux (Use Nasm and ld&gcc)
Assembly on x86_64 Linux Some instructions in Intel assembly set are invalid in x86_64 env. e.g. aaa ...
- Caffe源码解析1:Blob
转载请注明出处,楼燚(yì)航的blog,http://www.cnblogs.com/louyihang-loves-baiyan/ 首先看到的是Blob这个类,Blob是作为Caffe中数据流通的 ...
- AC日记——字符串位移包含问题 1.7 19
19:字符串移位包含问题 总时间限制: 1000ms 内存限制: 65536kB 描述 对于一个字符串来说,定义一次循环移位操作为:将字符串的第一个字符移动到末尾形成新的字符串. 给定两个字符串 ...
- Flex编译程序出现 Could not find compiled resource bundle 'SharedResources' for locale 'en_US'.
Flex编译程序出现 Could not find compiled resource bundle 'SharedResources' for locale 'en_US'. 而且静态类居然为nul ...
- poj[3093]Margaritas On River Walk
Description One of the more popular activities in San Antonio is to enjoy margaritas in the park alo ...
- java 接口(上)
1.接口中的方法都是抽象方法.而普通的抽象类里面不一定都是抽象方法.抽象类中必须有抽象方法,同时也可以有非抽象方法.继承抽象父类的子类中,如果依然有抽象方法,那么这个子类也是抽象类.即只要类中有抽象方 ...
- JavaScript Date 对象
JavaScript Date 对象 Date 对象 Date 对象用于处理日期与实际. 创建 Date 对象: new Date(). 以上四种方法同样可以创建 Date 对象: var d = n ...
- Nginx针对https站点的部署
一.Nginx安装(略)安装的时候需要注意加上 --with-http_ssl_module,因为http_ssl_module不属于Nginx的基本模块.Nginx安装方法:# ./configur ...