Android DatePickerWithNowButton添加了额外的日期标题

时间:2015-09-22 09:37:28

标签: java android android-studio datepickerdialog

当用户点击DatePickerWithNowButton时,我会显示TextView。有时候,当显示DatePickerWithNowButton时,它会添加灰色"额外"标题位于DatePickerWithNowButton之上,如图所示:

enter image description here

这里的代码我使用:

@Override
    public void onChooseDateClicked() {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(new Date(chosenDepartDate));
        final DatePickerWithNowButton dpd = new DatePickerWithNowButton(getActivity(), EditSearchFragment.this, calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH));

        dpd.getDatePicker().setMinDate(DateTimeManager.getInstance().getBestUTCTimeAtTheMoment());

        Calendar maxCal = Calendar.getInstance();
        maxCal.add(Calendar.DAY_OF_YEAR, 86);
        dpd.getDatePicker().setMaxDate(maxCal.getTimeInMillis());

        dpd.show();

        dpd.getButton(DialogInterface.BUTTON_NEUTRAL).setOnClickListener(
                new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        Calendar calendar = Calendar.getInstance();
                        onDateSet(null, calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH));
                        dpd.dismiss();
                    }
                });
        dpd.getButton(DialogInterface.BUTTON_NEGATIVE).setOnClickListener(
                new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        dpd.dismiss();
                    }
                });
    }

我以前没遇到过这个。任何人都知道发生了什么。正如我所说,它有时会发生,有时看起来应该没有灰色的额外标题。它还会将日期更改为我在日历中选择的日期。

0 个答案:

没有答案