DatePickerDialog使单击列在单击集上消失

时间:2012-07-04 13:53:44

标签: android android-fragments android-datepicker

我正在尝试使用DatePickerDialog,一切正常。只是当我点击“设置”时,月份列会在对话的其余部分之前消失一秒。

怎么了?

这是我正在使用的课程:

import java.util.Calendar;
import android.app.Activity;
import android.app.DatePickerDialog;
import android.app.DatePickerDialog.OnDateSetListener;
import android.app.Dialog;
import android.app.DialogFragment;
import android.os.Bundle;

public class DatePickerFragment extends DialogFragment {
    private Activity mActivity;

    public DatePickerFragment(Activity callback) {
        mActivity = callback;
    }

     public Dialog onCreateDialog(Bundle savedInstanceState) {
         //set the year to current minus 4, middle of the likely age range
         int year = Calendar.getInstance().get(Calendar.YEAR)-4;
         int month = 6;
         int day = 16;

         //This returns a dialog with the default date for the user to change.
         return new DatePickerDialog(getActivity(), (OnDateSetListener) mActivity, year, month, day);
     }
}

0 个答案:

没有答案