目前我使用的日期選擇器原生一個,但我想改變它,我只需要一個月,一年 如何修改這個我的代碼,這樣的方式是繼隱藏日期
@Override
protected Dialog onCreateDialog(int id) {
switch (id) {
case DATE_DIALOG_ID:
// set date picker as current date
return new DatePickerDialog(this, datePickerListener,
year, month,day);
}
return null;
}
private DatePickerDialog.OnDateSetListener datePickerListener
= new DatePickerDialog.OnDateSetListener() {
// when dialog box is closed, below method will be called.
public void onDateSet(DatePicker view, int selectedYear,
int selectedMonth, int selectedDay) {
/* year = selectedYear;
month = selectedMonth;
day = selectedDay;*/
mynewYear=selectedYear;
myNewMonth=selectedMonth;
myNewDay=selectedDay;
try {
checkDate();
} catch (NoSuchAlgorithmException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
/*time_date_TV.setText(new StringBuilder()
.append(myNewMonth + 1).append("/")
.append(myNewDay).append("/").append(mynewYear));
*/
}
};
我只是想隱藏日期部分的任何幫助將非常感謝全
也許此代碼示例幫助:https://github.com/bendemboski/DateSlider/tree/develop/src/com/googlecode/android/widgets/DateSlider –