を使用しDialogFragment
てDatePickerDialog
public class DatePickerFragment extends DialogFragment{
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
// Use the current date as the default date in the picker
final Calendar c = Calendar.getInstance();
int year = c.get(Calendar.YEAR);
int month = c.get(Calendar.MONTH);
int day = c.get(Calendar.DAY_OF_MONTH);
// Create a new instance of DatePickerDialog and return it
DatePickerDialog DatePickerDialog = new DatePickerDialog(getActivity(), (ProfileCreationActivity)getActivity(), year, month, day);
return DatePickerDialog;
}
私はスピナーの外観を好むカレンダーの外観を取得しています。
私は試した:
datePickerDialog.getDatePicker().setCalendarViewShown(false);
と
datePickerDialog.getDatePicker().setLayoutMode(1);
しかし、それは機能しません。
ある活動にはスピナーの外観が必要ですが、別の活動にはカレンダー ビューが必要であることに注意してください。そのため、アプリケーション スタイル全体を変更することはできません。1 つのアクティビティにカスタム スタイルが必要です。