Android DatePicker 样式
Android DatePicker styling
拼命尝试根据大量 SO 线程设置我的 DatePicker 的样式,但没有任何运气。不知道为什么。
我的问题是当前日期和选定日期不可见,因为它们具有与 DatePicker 背景相同的颜色。
日期选择器:
<DatePicker
android:id="@+id/DatePicker"
style="@style/date_picker_theme"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:calendarViewShown="false"
android:descendantFocusability="blocksDescendants"
android:endYear="2100"
android:startYear="1900" />
风格:
<style name="date_picker_theme" parent="Theme.AppCompat.Light.Dialog.Alert">
<!-- what do I need to add here in order to style the selected and current date? -->
</style>
我在 <style>
标签中添加的任何内容(来自 background
的应用程序)都不会影响 DatePicker 中的任何内容。
我 post 将此作为答案,因为我发现是什么阻碍了我的 DatePicker 样式,因此我的问题变得完全不同。
我无法影响 DatePicker 样式的原因是我的 theme.xml 文件包含 <item name="colorControlActivated">@color/white</item>
在 DatePicker 中导致白色选定日期背景,实际上也在应用程序中的其他一些元素上比如一些进度条。
我试过以 date_picker_theme
风格覆盖它:
<style name="date_picker_theme">
<item name="colorControlActivated">@color/green</item>
</style>
..但什么也没发生,所以我会 post 一个专门的问题。
更新
新问题 post 在此处编辑(并回答):
拼命尝试根据大量 SO 线程设置我的 DatePicker 的样式,但没有任何运气。不知道为什么。 我的问题是当前日期和选定日期不可见,因为它们具有与 DatePicker 背景相同的颜色。
日期选择器:
<DatePicker
android:id="@+id/DatePicker"
style="@style/date_picker_theme"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:calendarViewShown="false"
android:descendantFocusability="blocksDescendants"
android:endYear="2100"
android:startYear="1900" />
风格:
<style name="date_picker_theme" parent="Theme.AppCompat.Light.Dialog.Alert">
<!-- what do I need to add here in order to style the selected and current date? -->
</style>
我在 <style>
标签中添加的任何内容(来自 background
的应用程序)都不会影响 DatePicker 中的任何内容。
我 post 将此作为答案,因为我发现是什么阻碍了我的 DatePicker 样式,因此我的问题变得完全不同。
我无法影响 DatePicker 样式的原因是我的 theme.xml 文件包含 <item name="colorControlActivated">@color/white</item>
在 DatePicker 中导致白色选定日期背景,实际上也在应用程序中的其他一些元素上比如一些进度条。
我试过以 date_picker_theme
风格覆盖它:
<style name="date_picker_theme">
<item name="colorControlActivated">@color/green</item>
</style>
..但什么也没发生,所以我会 post 一个专门的问题。
更新
新问题 post 在此处编辑(并回答):