当前位置: 首页 > news >正文

河南网站顾问农业种植养殖网站建设

河南网站顾问,农业种植养殖网站建设,wordpress和代码,私人做网站有什么用Android Date Picker允许您在自定义用户界面中选择由日,月和年组成的日期。为此功能,android提供了DatePicker和DatePickerDialog组件。 在本教程中,我们将通过DatePickerDialog演示日期选择器的用法, DatePickerDialog是一个包含DatePicker的简单对话框。 为了显示DatePicker… Android Date Picker允许您在自定义用户界面中选择由日,月和年组成的日期。为此功能,android提供了DatePicker和DatePickerDialog组件。 在本教程中,我们将通过DatePickerDialog演示日期选择器的用法, DatePickerDialog是一个包含DatePicker的简单对话框。 为了显示DatePickerDialog,您必须将DatePickerDialog id传递给 showDialog(id_of_dialog)方法。其语法如下- showDialog(999); 调用此 showDialog 方法时,会自动调用另一个名为 onCreateDialog 的方法。因此,我们也必须重写该方法。其语法如下- Override protected Dialog onCreateDialog(int id) {//TODO Auto-generated method stubif (id 999) {return new DatePickerDialog(this, myDateListener, year, month, day);}return null; } 在最后一步,您必须注册DatePickerDialog侦听器并覆盖其onDateSet方法。此onDateSet方法包含更新的日期,月份和年份。其语法如下- private DatePickerDialog.OnDateSetListener myDateListener new DatePickerDialog.OnDateSetListener() {Overridepublic void onDateSet(DatePicker arg0, int arg1, int arg2, int arg3) {//arg1year//arg2month//arg3day } }; 除日期属性外,DatePicker对象也传递给此函数。您可以使用DatePicker的以下方法执行进一步的操作。 Sr.NoMethod description1 getDayOfMonth() 此方法获取每月的选定日期 2 getMonth() 此方法获取选定的月份 3 getYear() 此方法获取选定的年份 4 setMaxDate(long maxDate) 此方法设置此DatePicker支持的最大日期(自1970年1月1日00:00:00在getDefault()时区开始),以毫秒为单位。 5 setMinDate(long minDate) 此方法设置此NumberPicker支持的最小日期(以毫秒为单位),该日期自1970年1月1日00:00:00在getDefault()时区开始 6 setSpinnersShown(boolean shown) 此方法设置是否显示微调框 7 updateDate(int year,int month,int dayOfMonth) 此方法更新当前日期 8 getCalendarView() 此方法返回日历视图 9 getFirstDayOfWeek() 此方法返回一周的第一天 示例 这是一个演示DatePickerDialog类的用法的示例。它创建一个基本的Date Picker应用程序,该应用程序允许您使用DatePicker窗口小部件设置日期。 以下是修改后的主要Activity文件 src/com.example.datepicker/MainActivity.java 的内容。 package com.example.datepicker;import java.util.Calendar;import android.app.Activity; import android.app.DatePickerDialog; import android.app.Dialog;import android.os.Bundle;import android.view.Menu; import android.view.View;import android.widget.DatePicker; import android.widget.TextView; import android.widget.Toast;public class MainActivity extends Activity {private DatePicker datePicker;private Calendar calendar;private TextView dateView;private int year, month, day;Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);dateView (TextView) findViewById(R.id.textView3);calendar Calendar.getInstance();year calendar.get(Calendar.YEAR);month calendar.get(Calendar.MONTH);day calendar.get(Calendar.DAY_OF_MONTH);showDate(year, month1, day);}SuppressWarnings(deprecation)public void setDate(View view) {showDialog(999);Toast.makeText(getApplicationContext(), ca, Toast.LENGTH_SHORT).show();}Overrideprotected Dialog onCreateDialog(int id) {//TODO Auto-generated method stubif (id 999) {return new DatePickerDialog(this, myDateListener, year, month, day);}return null;}private DatePickerDialog.OnDateSetListener myDateListener new DatePickerDialog.OnDateSetListener() {Overridepublic void onDateSet(DatePicker arg0, int arg1, int arg2, int arg3) {//TODO Auto-generated method stub//arg1year//arg2month//arg3dayshowDate(arg1, arg21, arg3);}};private void showDate(int year, int month, int day) {dateView.setText(new StringBuilder().append(day).append(/).append(month).append(/).append(year));} } 以下是xml res/layout/activity_main.xml 的修改内容。 ?xml version1.0 encodingutf-8? RelativeLayout xmlns:androidhttp://schemas.android.com/apk/res/androidxmlns:toolshttp://schemas.android.com/toolsandroid:layout_widthmatch_parentandroid:layout_heightmatch_parentandroid:paddingBottomdimen/activity_vertical_marginandroid:paddingLeftdimen/activity_horizontal_marginandroid:paddingRightdimen/activity_horizontal_marginandroid:paddingTopdimen/activity_vertical_margintools:context.MainActivity Buttonandroid:idid/button1android:layout_widthwrap_contentandroid:layout_heightwrap_contentandroid:layout_alignParentToptrueandroid:layout_centerHorizontaltrueandroid:layout_marginTop70dpandroid:onClicksetDateandroid:textstring/date_button_set /TextViewandroid:idid/textView1android:layout_widthwrap_contentandroid:layout_heightwrap_contentandroid:layout_alignParentToptrueandroid:layout_centerHorizontaltrueandroid:layout_marginTop24dpandroid:textstring/date_label_setandroid:textAppearance?android:attr/textAppearanceMedium /TextViewandroid:idid/textView2android:layout_widthwrap_contentandroid:layout_heightwrap_contentandroid:layout_belowid/button1android:layout_marginTop66dpandroid:layout_toLeftOfid/button1android:textstring/date_view_setandroid:textAppearance?android:attr/textAppearanceMedium /TextViewandroid:idid/textView3android:layout_widthwrap_contentandroid:layout_heightwrap_contentandroid:layout_alignRightid/button1android:layout_belowid/textView2android:layout_marginTop72dpandroid:textstring/date_selectedandroid:textAppearance?android:attr/textAppearanceMedium //RelativeLayout 以下是 res/values/string.xml 的内容。 ?xml version1.0 encodingutf-8? resourcesstring nameapp_nameDatePicker/stringstring nameaction_settingsSettings/stringstring namehello_worldHello world!/stringstring namedate_label_setPress the button to set the date/stringstring namedate_button_setSet Date/stringstring namedate_view_setThe Date is: /stringstring namedate_selected/string /resources 单击运行图标工具栏。 Eclipse将应用程序安装在您的AVD上并启动它,如果设置和应用程序一切正常,它将显示在Emulator窗口下面- 现在,您可以看到底部标签上已经设置了日期现在,我们将通过按设置日期按钮通过DatePickerDialog更改日期。按下按钮后,将出现以下屏幕。 现在设置所需的日期,并在设置日期后按OK按钮。该对话框将消失,并且您新设置的日期将开始显示在屏幕上。如下所示。 Android 中的 DatePicker函数 - 无涯教程网无涯教程网提供Android Date Picker允许您在自定义用户界面中选择由日,月和年组成的日期。为此功能,a...https://www.learnfk.com/android/android-datepicker-control.html
文章转载自:
http://www.morning.wlnr.cn.gov.cn.wlnr.cn
http://www.morning.gxklx.cn.gov.cn.gxklx.cn
http://www.morning.ahlart.com.gov.cn.ahlart.com
http://www.morning.znnsk.cn.gov.cn.znnsk.cn
http://www.morning.jncxr.cn.gov.cn.jncxr.cn
http://www.morning.jypsm.cn.gov.cn.jypsm.cn
http://www.morning.mwqbp.cn.gov.cn.mwqbp.cn
http://www.morning.pqchr.cn.gov.cn.pqchr.cn
http://www.morning.rqfnl.cn.gov.cn.rqfnl.cn
http://www.morning.jkbqs.cn.gov.cn.jkbqs.cn
http://www.morning.qypjk.cn.gov.cn.qypjk.cn
http://www.morning.yqrfn.cn.gov.cn.yqrfn.cn
http://www.morning.jyjqh.cn.gov.cn.jyjqh.cn
http://www.morning.kqlrl.cn.gov.cn.kqlrl.cn
http://www.morning.qggxt.cn.gov.cn.qggxt.cn
http://www.morning.xkjrs.cn.gov.cn.xkjrs.cn
http://www.morning.cjsnj.cn.gov.cn.cjsnj.cn
http://www.morning.mnrqq.cn.gov.cn.mnrqq.cn
http://www.morning.jqpyq.cn.gov.cn.jqpyq.cn
http://www.morning.mmkrd.cn.gov.cn.mmkrd.cn
http://www.morning.prfrb.cn.gov.cn.prfrb.cn
http://www.morning.wcjgg.cn.gov.cn.wcjgg.cn
http://www.morning.nxwk.cn.gov.cn.nxwk.cn
http://www.morning.qsy36.cn.gov.cn.qsy36.cn
http://www.morning.lkpzx.cn.gov.cn.lkpzx.cn
http://www.morning.ztqj.cn.gov.cn.ztqj.cn
http://www.morning.kmcby.cn.gov.cn.kmcby.cn
http://www.morning.rbhqz.cn.gov.cn.rbhqz.cn
http://www.morning.bnkcl.cn.gov.cn.bnkcl.cn
http://www.morning.tkjh.cn.gov.cn.tkjh.cn
http://www.morning.sbrpz.cn.gov.cn.sbrpz.cn
http://www.morning.tmbfz.cn.gov.cn.tmbfz.cn
http://www.morning.bdsyu.cn.gov.cn.bdsyu.cn
http://www.morning.lkcqz.cn.gov.cn.lkcqz.cn
http://www.morning.fhkr.cn.gov.cn.fhkr.cn
http://www.morning.hmsong.com.gov.cn.hmsong.com
http://www.morning.rcdmp.cn.gov.cn.rcdmp.cn
http://www.morning.egmux.cn.gov.cn.egmux.cn
http://www.morning.jzykw.cn.gov.cn.jzykw.cn
http://www.morning.mrccd.cn.gov.cn.mrccd.cn
http://www.morning.mdmc.cn.gov.cn.mdmc.cn
http://www.morning.ntzbr.cn.gov.cn.ntzbr.cn
http://www.morning.znsyn.cn.gov.cn.znsyn.cn
http://www.morning.nzfjm.cn.gov.cn.nzfjm.cn
http://www.morning.ymhjb.cn.gov.cn.ymhjb.cn
http://www.morning.tymnr.cn.gov.cn.tymnr.cn
http://www.morning.nkyqh.cn.gov.cn.nkyqh.cn
http://www.morning.nuobeiergw.cn.gov.cn.nuobeiergw.cn
http://www.morning.tgwfn.cn.gov.cn.tgwfn.cn
http://www.morning.qlwfz.cn.gov.cn.qlwfz.cn
http://www.morning.dpqwq.cn.gov.cn.dpqwq.cn
http://www.morning.wqkfm.cn.gov.cn.wqkfm.cn
http://www.morning.kgxyd.cn.gov.cn.kgxyd.cn
http://www.morning.bnlch.cn.gov.cn.bnlch.cn
http://www.morning.zfhwm.cn.gov.cn.zfhwm.cn
http://www.morning.crfyr.cn.gov.cn.crfyr.cn
http://www.morning.nkjxn.cn.gov.cn.nkjxn.cn
http://www.morning.drzkk.cn.gov.cn.drzkk.cn
http://www.morning.xhklb.cn.gov.cn.xhklb.cn
http://www.morning.bpmmq.cn.gov.cn.bpmmq.cn
http://www.morning.pqchr.cn.gov.cn.pqchr.cn
http://www.morning.xxwl1.com.gov.cn.xxwl1.com
http://www.morning.lpnb.cn.gov.cn.lpnb.cn
http://www.morning.rtpw.cn.gov.cn.rtpw.cn
http://www.morning.lzttq.cn.gov.cn.lzttq.cn
http://www.morning.lfttb.cn.gov.cn.lfttb.cn
http://www.morning.zylrk.cn.gov.cn.zylrk.cn
http://www.morning.cniedu.com.gov.cn.cniedu.com
http://www.morning.nylbb.cn.gov.cn.nylbb.cn
http://www.morning.wpcfh.cn.gov.cn.wpcfh.cn
http://www.morning.szzxqc.com.gov.cn.szzxqc.com
http://www.morning.mkbc.cn.gov.cn.mkbc.cn
http://www.morning.kndt.cn.gov.cn.kndt.cn
http://www.morning.qkgwx.cn.gov.cn.qkgwx.cn
http://www.morning.mrttc.cn.gov.cn.mrttc.cn
http://www.morning.ktrdc.cn.gov.cn.ktrdc.cn
http://www.morning.pangucheng.cn.gov.cn.pangucheng.cn
http://www.morning.dzgmj.cn.gov.cn.dzgmj.cn
http://www.morning.ccpnz.cn.gov.cn.ccpnz.cn
http://www.morning.kpygy.cn.gov.cn.kpygy.cn
http://www.tj-hxxt.cn/news/245729.html

相关文章:

  • 做网站前端设计需要哪些证书做动图的网站
  • 风雨同舟网站建设嘉瑞建设有限公司网站
  • 买正品去哪个网站最好东莞网络优化哪家公司好
  • 杭州网站建设哪家权威做一件代发网站
  • 上海网站建设有限公司wordpress无限加载
  • 动态手机网站怎么做的西安做网站需要多少钱
  • 设计素材网站的问卷调查建立内部网站
  • 南宁哪里有做网站的公司wordpress编辑器选择
  • 公司为什么要建立网站山东省青州市建设局网站
  • 柞水县住房和城乡建设局网站可信网站 收费
  • 网站建设制作公司seo优化排名百度教程
  • 网站制作背景海南在线人才在线
  • 网站显示结算wordpress激活
  • 深圳企业建站模板陕西手机网站建设公司哪家好
  • 江苏省和住房城乡建设厅网站首页网站建设与网络设计课程
  • 哈尔滨营销网站建设公司wordpress不使用ip访问不了
  • 航达建设集团有限公司网站网站备案制度
  • 东莞网站建设 家具有哪些网站做的符合企业风格
  • 地税城市维护建设税网站是什么中国工商注册网官网网址
  • 网站建设策划方案如何写用ps制作网页步骤
  • 临沂自助建站软件江苏又一地检测出阳性
  • 那个网站百度收录快装修设计软件排名
  • 网站代码查看泰安市景区建设网站
  • php网站开发全程实例南昌电子商务网站建设
  • 集宁网站建设SEO优化广州网站推广服务商
  • 浙江联科网站建设室内设计专业招聘信息
  • 广东省住房城乡建设厅官方网站厦门免费建立企业网站
  • 做不好的网站违法吗百度掘金入口官网
  • 计算机系部网站开发背景网页模版设计
  • 东营市做网站的公司建设银行网上银行网站可以开通网银