Android 中的日期选择器显示问题
我在屏幕上使用日期选择器。但问题是它的显示不正确。请参阅此图片:
你可以看到那里,岁月正在流逝。为什么会发生这种情况。
编辑:
@Override
protected Dialog onCreateDialog(int id) {
Calendar c = Calendar.getInstance();
int cyear = c.get(Calendar.YEAR);
int cmonth = c.get(Calendar.MONTH);
int cday = c.get(Calendar.DAY_OF_MONTH);
switch (id) {
case DATE_DIALOG_ID:
return new DatePickerDialog(this, mDateSetListener, cyear, cmonth, cday);
}
return null;
}
private DatePickerDialog.OnDateSetListener mDateSetListener = new DatePickerDialog.OnDateSetListener() {
// onDateSet method
public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
//Toast.makeText(VideoPush.this, "Selected Date is ="+date_selected, Toast.LENGTH_SHORT).show();
}
};
当我单击textView时打开此对话框。
Am using Date Picker in my screen. But the problem is its not displaying correctly means.. see this image:
You can see there , year is cutting . Why it is happening.
Edited:
@Override
protected Dialog onCreateDialog(int id) {
Calendar c = Calendar.getInstance();
int cyear = c.get(Calendar.YEAR);
int cmonth = c.get(Calendar.MONTH);
int cday = c.get(Calendar.DAY_OF_MONTH);
switch (id) {
case DATE_DIALOG_ID:
return new DatePickerDialog(this, mDateSetListener, cyear, cmonth, cday);
}
return null;
}
private DatePickerDialog.OnDateSetListener mDateSetListener = new DatePickerDialog.OnDateSetListener() {
// onDateSet method
public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
//Toast.makeText(VideoPush.this, "Selected Date is ="+date_selected, Toast.LENGTH_SHORT).show();
}
};
When i click on textView am opening this dialog.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我宁愿使用它而不是默认日期选择器:
日期滑块
I would rather use this than Default Date Picker :
Date Slider