我使用DatePickerDialog创建了一个Activity。我希望它保持默认的系统外观,但是当我应用具有背景颜色的主题时,它也会使DatePickerDialog混乱。如何避免?
我的应用程序需要兼容android 4。+
这是主题:
<style name="LoginProcess" parent="Theme.AppCompat.Light">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="buttonStyle">@style/buttonLoginStyle</item>
<item name="android:background">@color/colorPrimaryDark</item>
<item name="android:buttonStyle">@style/buttonLoginStyle</item>
<item name="android:datePickerStyle">@android:style/Widget.DatePicker</item>
<item name="android:textColor">@color/white</item>
<item name="android:textColorPrimary">@color/white</item>
<item name="android:textColorHint">@color/login_transparent_white</item>
<item name="android:textColorSecondary">@color/colorAccent</item>
<item name="android:textColorSecondaryInverse">@android:color/white</item>
<item name="android:radioButtonStyle">@style/radioButtonStyleLogin</item>
</style>
当我点击某个按钮时,这是它执行的代码:
DatePickerDialog datePickerDialog = new DatePickerDialog(
v.getContext(),
birthdayDatePickerListener,
calendar.get(Calendar.YEAR) - 18,
calendar.get(Calendar.MONTH),
calendar.get(Calendar.DAY_OF_MONTH));
datePickerDialog.show();
提前致谢