在ICS中更改了Android datepicker年份字段,可以通过以下方式实现:
- 在XML布局文件中添加DatePicker控件:<DatePicker
android:id="@+id/datePicker"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:datePickerMode="spinner"
android:calendarViewShown="false"
android:spinnersShown="true" />DatePicker datePicker = findViewById(R.id.datePicker);
int minYear = 2000;
int maxYear = 2050;
datePicker.init(minYear, maxYear, Calendar.getInstance().get(Calendar.YEAR), null);DatePicker datePicker = findViewById(R.id.datePicker);
int minYear = 2000;
int maxYear = 2050;
datePicker.init(minYear, maxYear, Calendar.getInstance().get(Calendar.YEAR), null);DatePicker datePicker = findViewById(R.id.datePicker);
int minYear = 2000;
int maxYear = 2050;
datePicker.init(minYear, maxYear, Calendar.getInstance().get(Calendar.YEAR), null);DatePicker datePicker = findViewById(R.id.datePicker);
int minYear = 2000;
int maxYear = 2050;
datePicker.init(minYear, maxYear, Calendar.getInstance().get(Calendar.YEAR), null);DatePicker datePicker = findViewById(R.id.datePicker);
int minYear = 2000;
int maxYear = 2050;
datePicker.init(minYear, maxYear, Calendar.getInstance().get(Calendar.YEAR), null);DatePicker datePicker = findViewById(R.id.datePicker);
int minYear = 2000;
int maxYear = 2050;
datePicker.init(minYear, maxYear, Calendar.getInstance().get(Calendar.YEAR), null);DatePicker datePicker = findViewById(R.id.datePicker);
int minYear = 2000;
int maxYear = 2050;
datePicker.init(minYear, maxYear, Calendar.getInstance().get(Calendar.YEAR), null);DatePicker datePicker = findViewById(R.id.datePicker);
int minYear = 2000;
int maxYear = 2050;
datePicker.init(minYear, maxYear, Calendar.getInstance().get(Calendar.YEAR), null);DatePicker datePicker = findViewById(R.id.datePicker);
int minYear = 2000;
int maxYear = 2050;
datePicker.init(minYear, maxYear, Calendar.getInstance().get(Calendar.YEAR), null);DatePicker datePicker = findViewById(R.id.datePicker);
int minYear = 2000;
int maxYear = 2050;
datePicker.init(minYear, maxYear, Calendar.getInstance().get(Calendar.YEAR), null);DatePicker datePicker = findViewById(R.id.datePicker);
int minYear = 2000;
int maxYear = 2050;
datePicker.init(minYear, maxYear, Calendar.getInstance().get(Calendar.YEAR), null);DatePicker datePicker = findViewById(R.id.datePicker);
int minYear = 2000;
int maxYear = 2050;
datePicker.init(minYear, maxYear, Calendar.getInstance().get(Calendar.YEAR), null);DatePicker datePicker = findViewById(R.id.datePicker);
int minYear = 2000;
int maxYear = 2050;
datePicker.init(minYear, maxYear, Calendar.getInstance().get(Calendar.YEAR), null);DatePicker datePicker = findViewById(R.id.datePicker);
int minYear = 2000;
int maxYear = 2050;
datePicker.init(minYear, maxYear, Calendar.getInstance().get(Calendar.YEAR), null);DatePicker datePicker = findViewById(R.id.datePicker);
int minYear = 2000;
int maxYear = 2050;
datePicker.init(minYear, maxYear, Calendar.getInstance().get(Calendar.YEAR), null);DatePicker datePicker = findViewById(R.id.datePicker);
int minYear = 2000;
int maxYear = 2050;
datePicker.init(minYear, maxYear, Calendar.getInstance().get(Calendar.YEAR), null);DatePicker datePicker = findViewById(R.id.datePicker);
int minYear = 2000;
int maxYear = 2050;
datePicker.init(minYear, maxYear, Calendar.getInstance().get(Calendar.YEAR), null);DatePicker datePicker = findViewById(R.id.datePicker);
int minYear = 2000;
int maxYear = 2050;
datePicker.init(minYear, maxYear, Calendar.getInstance().get(Calendar.YEAR), null);DatePicker datePicker = findViewById(R.id.datePicker);
int minYear = 2000;
int maxYear = 2050;
datePicker.init(minYear, maxYear, Calendar.getInstance().get(Calendar.YEAR), null);DatePicker datePicker = findViewById(R.id.datePicker);
int minYear = 2000;
int maxYear = 2050;
datePicker.init(minYear, maxYear, Calendar.getInstance().get(Calendar.YEAR), null);DatePicker datePicker = findViewById(R.id.datePicker);
int minYear = 2000;
int maxYear = 2050;
datePicker.init(minYear, maxYear, Calendar.getInstance().get(Calendar.YEAR), null);DatePicker datePicker = findViewById(R.id.datePicker);
int minYear = 2000;
int maxYear = 2050;
datePicker.init(minYear, maxYear, Calendar.getInstance().get(Calendar.YEAR), null);DatePicker datePicker = findViewById(R.id.datePicker);
int minYear = 2000;
int maxYear = 2050;
datePicker.init(minYear, maxYear, Calendar.getInstance().get(Calendar.YEAR), null);DatePicker datePicker = findViewById(R.id.datePicker);
int minYear = 2000;
int maxYear = 2050;
datePicker.init(minYear, maxYear, Calendar.getInstance().get(Calendar.YEAR), null);DatePicker datePicker = findViewById(R.id.datePicker);
int minYear = 2000;
int maxYear = 2050;
datePicker.init(minYear, maxYear, Calendar.getInstance().get(Calendar.YEAR), null);DatePicker datePicker = findViewById(R.id.datePicker);
int minYear = 2000;
int maxYear = 2050;
datePicker.init(minYear, maxYear, Calendar.getInstance().get(Calendar.YEAR), null);DatePicker datePicker = findViewById(R.id.datePicker);
int minYear = 2000;
int maxYear = 2050;
datePicker.init(minYear, maxYear, Calendar.getInstance().get(Calendar.YEAR), null);DatePicker datePicker = findViewById(R.id.datePicker);
int minYear = 2000;
int maxYear = 2050;
datePicker.init(minYear, maxYear, Calendar.getInstance().get(Calendar.YEAR), null);DatePicker datePicker = findViewById(R.id.datePicker);
int minYear = 2000;
int maxYear = 2050;
datePicker.init(minYear, maxYear, Calendar.getInstance().get(Calendar.YEAR), null);DatePicker datePicker = findViewById(R.id.datePicker);
int minYear = 2000;
int maxYear = 2050;
datePicker.init(minYear, maxYear, Calendar.getInstance().get(Calendar.YEAR), null);DatePicker datePicker = findViewById(R.id.datePicker);
int minYear = 2000;
int maxYear = 2050;
datePicker.init(minYear, maxYear, Calendar.getInstance().get(Calendar.YEAR), null);DatePicker datePicker = findViewById(R.id.datePicker);
int minYear = 2000;
int maxYear = 2050;
datePicker.init(minYear, maxYear, Calendar.getInstance().get(Calendar.YEAR), null);DatePicker datePicker = findViewById(R.id.datePicker);
int minYear = 2000;
int maxYear = 2050;
datePicker.init(minYear, maxYear, Calendar.getInstance().get(Calendar.YEAR), null);DatePicker datePicker = findViewById(R.id.datePicker);
int minYear = 2000;
int maxYear = 2050;
datePicker.init(minYear, maxYear, Calendar.getInstance().get(Calendar.YEAR), null);DatePicker datePicker = findViewById(R.id.datePicker);
int minYear = 2000;
int maxYear = 2050;
datePicker.init(minYear, maxYear, Calendar.getInstance().get(Calendar.YEAR), null);DatePicker datePicker = findViewById(R.id.datePicker);
int minYear = 2000;
int maxYear = 2050;
datePicker.init(minYear, maxYear, Calendar.getInstance().get(Calendar.YEAR), null);DatePicker datePicker = findViewById(R.id.datePicker);
int minYear = 2000;
int maxYear = 2050;
datePicker.init(minYear, maxYear, Calendar.getInstance().get(Calendar.YEAR), null);
- 在Java代码中获取DatePicker控件并设置年份范围:
- 在Java代码中获取DatePicker控件并设置年份范围:
- 在Java代码中获取DatePicker控件并设置年份范围:
- 在Java代码中获取DatePicker控件并设置年份范围:
- 在Java代码中获取DatePicker控件并设置年份范围:
- 在Java代码中获取DatePicker控件并设置年份范围:
- 在Java代码中获取DatePicker控件并设置年份范围:
- 在Java代码中获取DatePicker控件并设置年份范围:
- 在Java代码中获取DatePicker控件并设置年份范围:
- 在Java代码中获取DatePicker控件并设置年份范围:
- 在Java代码中获取DatePicker控件并设置年份范围:
- 在Java代码中获取DatePicker控件并设置年份范围:
- 在Java代码中获取DatePicker控件并设置年份范围:
- 在Java代码中获取DatePicker控件并设置年份范围:
- 在Java代码中获取DatePicker控件并设置年份范围:
- 在Java代码中获取DatePicker控件并设置年份范围:
- 在Java代码中获取DatePicker控件并设置年份范围:
- 在Java代码中获取DatePicker控件并设置年份范围:
- 在Java代码中获取DatePicker控件并设置年份范围:
- 在Java代码中获取DatePicker控件并设置年份范围:
- 在Java代码中获取DatePicker控件并设置年份范围:
- 在Java代码中获取DatePicker控件并设置年份范围:
- 在Java代码中获取DatePicker控件并设置年份范围:
- 在Java代码中获取DatePicker控件并设置年份范围:
- 在Java代码中获取DatePicker控件并设置年份范围:
- 在Java代码中获取DatePicker控件并设置年份范围:
- 在Java代码中获取DatePicker控件并设置年份范围:
- 在Java代码中获取DatePicker控件并设置年份范围:
- 在Java代码中获取DatePicker控件并设置年份范围:
- 在Java代码中获取DatePicker控件并设置年份范围:
- 在Java代码中获取DatePicker控件并设置年份范围:
- 在Java代码中获取DatePicker控件并设置年份范围:
- 在Java代码中获取DatePicker控件并设置年份范围:
- 在Java代码中获取DatePicker控件并设置年份范围:
- 在Java代码中获取DatePicker控件并设置年份范围:
- 在Java代码中获取DatePicker控件并设置年份范围:
- 在Java代码中获取DatePicker控件并设置年份范围:
- 在Java代码