Chinaunix首页 | 论坛 | 博客
  • 博客访问: 7563334
  • 博文数量: 961
  • 博客积分: 15795
  • 博客等级: 上将
  • 技术积分: 16612
  • 用 户 组: 普通用户
  • 注册时间: 2010-08-07 14:23
文章分类

全部博文(961)

文章存档

2016年(1)

2015年(61)

2014年(41)

2013年(51)

2012年(235)

2011年(391)

2010年(181)

分类: Android平台

2015-11-19 16:26:09

?日期选择器(DatePicker)和时间选择器(TimePicker)可以用于进行日期与时间的调整,当两者进行调整的时候也可以采用相关的监听器对其状态进行监听:
?日期监听器接口:android.widget.DatePicker.OnDateChangedListener;
?时间监听器接口:android.widget.TimePicker.OnTimeChangedListener;

点击(此处)折叠或打开

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <LinearLayout                 ?    定义线型布局管理器
  3.     xmlns:android=""
  4.     android:orientation="vertical"         ?    所有组件垂直摆放
  5.     android:layout_width="fill_parent"        ?    布局管理器宽度为屏幕宽度
  6.     android:layout_height="fill_parent">    ?    布局管理器高度为屏幕高度
  7.     <EditText                 ?    文本输入组件
  8.         android:id="@+id/input"     ?    组件ID,程序中使用
  9.         android:layout_width="fill_parent“        ?    组件宽度为屏幕宽度
  10.         android:layout_height="wrap_content"/>    ?    组件高度为文字高度
  11.     
  12.         xmlns:android="http://schemas.android.com/apk/res/android"
  13.         android:orientation="horizontal"         ?    所有组件水平摆放
  14.         android:layout_width="fill_parent"        ?    布局管理器宽度为屏幕宽度
  15.         android:layout_height="fill_parent">    ?    布局管理器高度为屏幕高度
  16.         <DatePicker             ?    日期选择器
  17.             android:id="@+id/date"         ?    组件ID,程序中使用
  18.             android:layout_width="wrap_content”?    组件宽度为显示宽度
  19.             android:layout_height="wrap_content" />?    组件高度为显示高度
  20.         
  21.             android:id="@+id/time"         ?    组件ID,程序中使用
  22.             android:layout_width="wrap_content”?    组件宽度为显示宽度
  23.             android:layout_height="wrap_content" />?    组件高度为显示高度
  24.     </LinearLayout>
  25. </LinearLayout>
020605_监听日期与时间的改变.ppt
阅读(1027) | 评论(0) | 转发(0) |
0

上一篇:下拉列表监听

下一篇:焦点事件

给主人留下些什么吧!~~