当用户在日期选择器中进行更改时,我想更改标题(用户选择的要显示的日期)。任何想法我正在使用此代码。ondatechange 不工作听到
public void showDatePicker(){
LayoutInflater inflat=(LayoutInflater) getLayoutInflater();
final AlertDialog.Builder pick=new AlertDialog.Builder(this);
View customView=inflat.inflate(R.layout.pickdate, null);
final DatePicker datePicker =
(DatePicker) customView.findViewById(R.id.datePicker1);
TimePicker timePicker=(TimePicker) customView.findViewById(R.id.timePicker1);
timePicker.setBackgroundResource(R.drawable.ic_launcher);
//datePicker.setMinDate(minDate.getTimeInMillis());
String title=String.valueOf(datePicker.getDayOfMonth());
pick.setView(customView);
pick.setTitle(title);
Calendar today=Calendar.getInstance();
pick.setPositiveButton(android.R.string.ok,new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
//Toast.makeText(getApplicationContext(), String.valueOf(datePicker.getYear()), Toast.LENGTH_SHORT).show();
}
});
pick.setNegativeButton(android.R.string.cancel,new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
pick.show();
}