标签:
非常简单直接上代码:
final EditText et1=(EditText)findViewById(R.id.editText1); final Calendar c = Calendar.getInstance(); et1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { DatePickerDialog dialog = new DatePickerDialog(MainActivity.this, new DatePickerDialog.OnDateSetListener() { @Override public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { c.set(year, monthOfYear, dayOfMonth); et1.setText(DateFormat.format("yyy-MM-dd", c)); } }, c.get(Calendar.YEAR), c.get(Calendar.MONTH), c.get(Calendar.DAY_OF_MONTH)); dialog.show(); } });
<转>Android开发使输入框点击弹出日期选择对话框的方法
标签:
原文地址:http://www.cnblogs.com/xiaodeyao/p/5053217.html