DatePicker的分割线颜色设置

/**
*
* 设置时间选择器的分割线颜色
* @param datePicker
*/
private void setDatePickerDividerColor(DatePicker datePicker){
// Divider changing: // 获取 mSpinners
LinearLayout llFirst = (LinearLayout) datePicker.getChildAt(); // 获取 NumberPicker
LinearLayout mSpinners = (LinearLayout) llFirst.getChildAt();
for (int i = ; i < mSpinners.getChildCount(); i++) {
NumberPicker picker = (NumberPicker) mSpinners.getChildAt(i); Field[] pickerFields = NumberPicker.class.getDeclaredFields();
for (Field pf : pickerFields) {
if (pf.getName().equals("mSelectionDivider")) {
pf.setAccessible(true);
try {
pf.set(picker, new ColorDrawable(ResourceUtil.getColor(R.color.com_text_red)));
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (NotFoundException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
break;
}
}
}
}
上一篇:bootstrap-table 行内编辑


下一篇:Html5选择本地视频音频文件播放