1
我想在Android中創建一個自定義日期選擇器,它將只顯示星期一至星期五的週一到週五。尋找一些幫助開始。Android如何從android默認日期選擇器中避免週末
我想在Android中創建一個自定義日期選擇器,它將只顯示星期一至星期五的週一到週五。尋找一些幫助開始。Android如何從android默認日期選擇器中避免週末
看看這個project。
在這種情況下,他只能去除週日但可以調整它也除去週六,就像這樣:
if (choosenDate.get(Calendar.DAY_OF_WEEK) ==
Calendar.SUNDAY || Calendar.DAY_OF_WEEK) ==
Calendar.SATURDAY ||
now.compareTo(choosenDate) < 0) {
dateTextView.setTextColor(
Color.parseColor("#ff0000")
);
((Button) dialog.getButton(
AlertDialog.BUTTON_POSITIVE))
.setEnabled(false);
}
希望它能幫助。
*硬是阻止可供選擇它們的用戶,但我認爲你可以將其隱藏像這裏面你如果:
dateTextView.setVisibility(View.GONE);
我想,鏈接代碼,但它包含錯誤。我現在使用日期滑塊並試圖跳過週末。 –