首页 新闻 会员 周边 捐助

android

0
悬赏园豆:10 [待解决问题]
Calendar date = Calendar.getInstance();
new DatePickerDialog(Ledger_Dinner_Detail.this,
// 绑定监听器
new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker dp, int year,
int month, int dayOfMonth) {
StringBuilder temp = new StringBuilder()
.append(year)
.append("-")
.append((month + 1) < 10 ? "0"
+ (month + 1) : (month + 1))
.append("-")
.append(dayOfMonth < 10 ? "0"
+ dayOfMonth : dayOfMonth);
String date = temp.toString();
DinnerDate.setText(date);
}
}
// 设置初始日期
, date.get(Calendar.YEAR), date.get(Calendar.MONTH), date
.get(Calendar.DAY_OF_MONTH)).show();

为什么Debug运行的时候报错,其他正常。
开发环境android studio
错误代码:
 android.view.InflateException: Binary XML file line #20: Error inflating class android.widget.DatePicker
            at android.view.LayoutInflater.createView(LayoutInflater.java:623)
            at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
            at android.view.LayoutInflater.onCreateView(LayoutInflater.java:672)
            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:697)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:472)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:400)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
            at android.app.DatePickerDialog.<init>(DatePickerDialog.java:108)
            at android.app.DatePickerDialog.<init>(DatePickerDialog.java:79)
小小志向的主页 小小志向 | 初学一级 | 园豆:15
提问于:2015-11-06 15:56
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册