Android 中的 DatePickerDialog 问题

DatePickerDialog Issue in Android

我在 DatePickerDialog 中看不到 Day 的首字母

我想要的是:

我用来显示对话框的代码是:

 DatePickerDialog dialog = new DatePickerDialog(context, startingDateSetListener,
                    starting_date_object.getYear(),
                    starting_date_object.getMonthOfYear()-1,
                    starting_date_object.getDayOfMonth());

            dialog.getDatePicker().setMaxDate(ending_date_object.getMillis());
            dialog.show();

日子可能在那里,但他们的 textColor 与背景相同,因此您看不到它们。这与对话框的 style/theme 有关。
styles.xml 中创建主题,例如:

<style name="DatePickerTheme" parent="Theme.AppCompat.Light.Dialog">
    <item name="colorAccent">@color/your_accent_color</item>
    <item name="colorControlActivated">@color/your_control_activated_color</item>
</style>

并通过提供主题初始化 DatePickerDialog:

 DatePickerDialog dialog = new DatePickerDialog(context,
                    R.style.DatePickerTheme, 
                    startingDateSetListener,
                    starting_date_object.getYear(),
                    starting_date_object.getMonthOfYear()-1,
                    starting_date_object.getDayOfMonth());