如何更改日期选择器的风格在android系统? [英] How to change the style of Date picker in android?

查看:737
本文介绍了如何更改日期选择器的风格在android系统?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想改变日期或​​时间选择对话框的默认颜色在android系统,所以它应该与我的应用程序的主题。我搜索的谷歌一样,但我无法找到一个有效的解决方案。

I want to change the default color of the date or time picker dialog in android, so that it should match my app's theme. I searched for the same on google, but I couldn't find a valid solution.

我在做什么时,我创建一个新的风格。

What I was doing is, I was creating a new style .

  <style name="datepicker" parent="@android:style/Widget.DeviceDefault.DatePicker">
    <!---TODO-->
    <item name="android:focusedMonthDateColor">@android:color/holo_red_dark</item>
</style>

不知道有什么可用于日期选取器的台词的属性,如果有人张贴了一个链接,这将是葛丽泰

和增加我被调用它的样式在我的主风格

and after adding the style i was calling it in my main style as

 <item name="android:datePickerStyle">@style/datepicker</item>

不幸的是,这并没有为我工作的。

Unfortunately, this didn't work for me at all.

推荐答案

试试这个

    <style name="datepicker" parent="Theme.AppCompat.Light.Dialog">
    <item name="colorPrimary">@color/primary</item>
    <item name="colorPrimaryDark">@color/primary_dark</item>
    <item name="colorAccent">@color/primary</item>

</style>

这篇关于如何更改日期选择器的风格在android系统?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆