更改 DatePicker 的字体颜色 Android
Change fontcolor of DatePicker Android
我正在尝试更改日期选择器的字体颜色,
我已经在搜索,但我无法得到准确的答案。
请你帮助我好吗?
我的布局是这样的:
<DatePicker
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/datePicker"
android:calendarViewShown="false"
android:spinnersShown="true"
android:datePickerMode="spinner"
android:layout_below="@+id/tb_register_last_name"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignRight="@+id/bt_register_tostep3"
android:layout_alignEnd="@+id/bt_register_tostep3"
style="@style/MyDatePicker"/>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="android:datePickerStyle">@style/MyDatePicker</item>
</style>
<style name="MyDatePicker" parent="Theme.AppCompat.Light.Dialog">
<item name="colorPrimary">**@color/CorProfilePi**c</item>
<item name="colorPrimaryDark">**@color/CorProfilePic**</item>
<item name="colorAccent">**@color/CorProfilePic**</item>
</style>
Colors.xml:
<resources>
<color name="colorPrimary">#479dcc</color>
<color name="colorPrimaryDark">#146ba6</color>
<color name="colorAccent">#0a8da0</color>
<color name="CorProfilePic">#ffffff</color>
我做错了什么?
谢谢!
(我是 android 开发新手)
谢谢!
EDIT2:有效。(添加分隔线颜色)
Your XML
<DatePicker
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/datePicker"
android:calendarViewShown="false"
android:spinnersShown="true"
android:datePickerMode="spinner"
android:layout_below="@+id/tb_register_last_name"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignRight="@+id/bt_register_tostep3"
android:layout_alignEnd="@+id/bt_register_tostep3"
android:theme="@style/MyDatePicker"/>
In styles.xml, set this (copy-paste the code)
<style name="MyDatePicker" parent="Theme.AppCompat.Light.Dialog.Alert">
<item name="colorControlNormal">#00FF00</item>
<item name="colorControlActivated">#00FF00</item>
<item name="android:textColorPrimary">#FF0000</item>
</style>
Googlematerialdoc以后对你有帮助
改变你的风格,让我知道它是否有效!!
我正在尝试更改日期选择器的字体颜色, 我已经在搜索,但我无法得到准确的答案。 请你帮助我好吗? 我的布局是这样的:
<DatePicker
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/datePicker"
android:calendarViewShown="false"
android:spinnersShown="true"
android:datePickerMode="spinner"
android:layout_below="@+id/tb_register_last_name"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignRight="@+id/bt_register_tostep3"
android:layout_alignEnd="@+id/bt_register_tostep3"
style="@style/MyDatePicker"/>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="android:datePickerStyle">@style/MyDatePicker</item>
</style>
<style name="MyDatePicker" parent="Theme.AppCompat.Light.Dialog">
<item name="colorPrimary">**@color/CorProfilePi**c</item>
<item name="colorPrimaryDark">**@color/CorProfilePic**</item>
<item name="colorAccent">**@color/CorProfilePic**</item>
</style>
Colors.xml:
<resources>
<color name="colorPrimary">#479dcc</color>
<color name="colorPrimaryDark">#146ba6</color>
<color name="colorAccent">#0a8da0</color>
<color name="CorProfilePic">#ffffff</color>
我做错了什么? 谢谢! (我是 android 开发新手) 谢谢!
EDIT2:有效。(添加分隔线颜色)
Your XML
<DatePicker
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/datePicker"
android:calendarViewShown="false"
android:spinnersShown="true"
android:datePickerMode="spinner"
android:layout_below="@+id/tb_register_last_name"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignRight="@+id/bt_register_tostep3"
android:layout_alignEnd="@+id/bt_register_tostep3"
android:theme="@style/MyDatePicker"/>
In styles.xml, set this (copy-paste the code)
<style name="MyDatePicker" parent="Theme.AppCompat.Light.Dialog.Alert">
<item name="colorControlNormal">#00FF00</item>
<item name="colorControlActivated">#00FF00</item>
<item name="android:textColorPrimary">#FF0000</item>
</style>
Googlematerialdoc以后对你有帮助
改变你的风格,让我知道它是否有效!!