fromdateとtodateを選択するフィールドが2つあります。古い日付ピッカーのダイアログは、過去の日付を制限し、選択されたfromdateの+7日後にのみ表示する必要があります。 fromdateダイアログは、現在の日付の7つ前の日付のみを表示し、他の日付を隠す必要があります。alertdialog.builderの過去の日付を非表示にする方法datepicker
1
A
答えて
0
あなたはd
は、ダイアログ日付ピッカーでコード
d.getDatePicker().setMinDate(System.currentTimeMillis() - 1000);
d.getDatePicker().setMaxDate(System.currentTimeMillis() - 1000 + 86400000*day);
のこれらの行を使用することができます
0
あり、これを制御するための簡単なオプションがあり、また、ちょうどTimeSquareライブラリを使用し、全体のカレンダーのオプションを制御しています最小日数と最大日数を設定する方法に加えて、あなたのカレンダーの作成を処理し、それをインポートしてCalendarPickerView
オブジェクトを作成し、次のように最小値と最大値を設定します:
Calendar firstYear = Calendar.getInstance();
Calendar lastYear = Calendar.getInstance();
firstYear.add(Calendar.YEAR, 0); // this will close all the past days
lastYear.add(Calendar.YEAR, 20); // this will make your calendar length is 20 years
CalendarPickerView calendar = (CalendarPickerView) findViewById(R.id.calendar_view);
calendar.init(firstYear.getTime(), lastYear.getTime())
.withSelectedDate(Calendar.getInstance().getTime());
[setMinDateおよびsetMaxDate](http://developer.android.com/reference/android/widget/DatePicker.html)メソッドを参照してください。 –