AndroidPicker
AndroidPicker copied to clipboard
日期选择器
trafficstars
能给年,月,日单独设置背景吗
能给年,月,日单独设置背景吗
能的,例如:
DatePicker picker = new DatePicker(this);
picker.setOnDatePickedListener(this);
picker.setBodyWidth(240);
picker.setBackgroundColor(0xEEDDDDDD);
picker.getHeaderView().setBackgroundColor(0xFFCCCCCC);
DateWheelLayout wheelLayout = picker.getWheelLayout();
wheelLayout.setDateMode(DateMode.YEAR_MONTH_DAY);
wheelLayout.setDateLabel("年", "月", "日");
wheelLayout.setRange(DateEntity.today(), DateEntity.target(2050, 12, 31), DateEntity.today());
wheelLayout.setCurtainEnabled(true);
wheelLayout.setCurtainColor(0xFFCC0000);
wheelLayout.setIndicatorEnabled(true);
wheelLayout.setIndicatorColor(0xFFFF0000);
wheelLayout.setIndicatorSize(view.getResources().getDisplayMetrics().density * 2);
wheelLayout.setTextColor(0xCCCC0000);
wheelLayout.setSelectedTextColor(0xFF00FF00);
wheelLayout.getYearWheelView().setBackgroundColor(0x90CCCCCC);
wheelLayout.getMonthWheelView().setBackgroundColor(0x90CCCCCC);
wheelLayout.getDayWheelView().setBackgroundColor(0x90CCCCCC);
picker.show();
