coloraccent不适用于datepicker android

时间:2016-10-26 11:03:32

标签: android datepicker

我已在styles.xml

中声明了素材主题
  <style name="SignUpMaterialTheme.Base"       
  parent="Theme.AppCompat.Light.DarkActionBar">
    <item name="windowNoTitle">true</item>
    <item name="windowActionBar">false</item>
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/splashBg</item>
    <item name="colorAccent">@color/colorPrimary</item>
    <item name="colorControlNormal">#f2efea</item>
    <item name="colorControlActivated">#f2efea</item>
  </style>

我正在EditText使用TextInputLayout,所以当我点击它时,我会显示DatePickerDialog。现在我遇到的问题是所选颜色的日期显示为白色,但我已经在我的风格中声明了颜色accent。当我尝试删除colorControlNormalcolorControlActivated时,它会将所选日期显示为accent颜色,但TextInputLayout颜色会变为黑色。怎么办?

有什么建议吗?

1 个答案:

答案 0 :(得分:0)

浅色:

DatePickerDialog datepickerdialog = new DatePickerDialog(getActivity(),
AlertDialog.THEME_DEVICE_DEFAULT_DARK,this,year,month,day);

暗色:

DatePickerDialog datepickerdialog = new DatePickerDialog(getActivity(),
 AlertDialog.THEME_DEVICE_DEFAULT_LIGHT,this,year,month,day);