在 android 的微调器模式下更改日期选择器文本颜色?
Change date-picker text color in spinner mode in android?
我试过使用自定义样式,但它不起作用,它的默认颜色是灰色的,我希望它是白色的,有人可以帮我吗? TIA
XML
<DatePicker
android:id="@+id/user_dob"
android:hapticFeedbackEnabled="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:calendarViewShown="false"
style="@style/MyDatePickerStyle"
android:datePickerMode="spinner"/>
styles
<style name="MyDatePickerStyle" parent="@android:style/Widget.Material.Light.DatePicker" tools:targetApi="lollipop">
<item name="android:headerBackground">@color/white</item>
<item name="android:calendarTextColor">@color/white</item>
<item name="android:dayOfWeekBackground">@color/white</item>
<item name="android:yearListSelectorColor">@color/white</item>
<item name="android:datePickerMode">calendar</item>
<item name="android:minDate">01/01/1970</item>
</style>
您可以使用:
<DatePicker
android:theme="@style/MyDatePicker"
..>
与:
<style name="MyDatePicker" >
<!-- Text color -->
<item name="android:textColorPrimary">@color/....</item>
<!-- Divider color -->
<item name="colorControlNormal">@color/...</item>
</style>
我试过使用自定义样式,但它不起作用,它的默认颜色是灰色的,我希望它是白色的,有人可以帮我吗? TIA
XML
<DatePicker
android:id="@+id/user_dob"
android:hapticFeedbackEnabled="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:calendarViewShown="false"
style="@style/MyDatePickerStyle"
android:datePickerMode="spinner"/>
styles
<style name="MyDatePickerStyle" parent="@android:style/Widget.Material.Light.DatePicker" tools:targetApi="lollipop">
<item name="android:headerBackground">@color/white</item>
<item name="android:calendarTextColor">@color/white</item>
<item name="android:dayOfWeekBackground">@color/white</item>
<item name="android:yearListSelectorColor">@color/white</item>
<item name="android:datePickerMode">calendar</item>
<item name="android:minDate">01/01/1970</item>
</style>
您可以使用:
<DatePicker
android:theme="@style/MyDatePicker"
..>
与:
<style name="MyDatePicker" >
<!-- Text color -->
<item name="android:textColorPrimary">@color/....</item>
<!-- Divider color -->
<item name="colorControlNormal">@color/...</item>
</style>