猿问

更改Android 5.0的Datepicker对话框颜色

更改Android 5.0的Datepicker对话框颜色

是否可以更改android 5.0的datepicker(以及timepicker)配色方案?


我尝试设置强调色,但这不起作用(有和没有android:):


<!-- colorPrimary is used for the default action bar background -->

<item name="colorPrimary">@color/purple</item>


<!-- colorPrimaryDark is used for the status bar -->

<item name="colorPrimaryDark">@color/purple_tint</item>


<!-- colorAccent is used as the default value for colorControlActivated

     which is used to tint widgets -->

<item name="colorAccent">@color/purple_tint</item>

来自原文: 

对于这样的事情: 

https://img2.mukewang.com/5d5650750001fd7e07201280.png


临摹微笑
浏览 1469回答 3
3回答

慕村9548890

试试这个,为我工作把两个选项,colorAccent和android:colorAccent<style&nbsp;name="AppTheme"&nbsp;parent="@style/Theme.AppCompat.Light.NoActionBar"> &nbsp;&nbsp;&nbsp;&nbsp;<!--&nbsp;Customize&nbsp;your&nbsp;theme&nbsp;here.&nbsp;--> &nbsp;&nbsp;&nbsp;.... &nbsp;&nbsp;&nbsp;&nbsp;<item&nbsp;name="android:dialogTheme">@style/AppTheme.DialogTheme</item> &nbsp;&nbsp;&nbsp;&nbsp;<item&nbsp;name="android:datePickerDialogTheme">@style/Dialog.Theme</item></style><style&nbsp;name="AppTheme.DialogTheme"&nbsp;parent="Theme.AppCompat.Light.Dialog"><!--&nbsp;Put&nbsp;the&nbsp;two&nbsp;options,&nbsp;colorAccent&nbsp;and&nbsp;android:colorAccent.&nbsp;--> &nbsp;&nbsp;&nbsp;&nbsp;<item&nbsp;name="colorAccent">@color/colorPrimary</item> &nbsp;&nbsp;&nbsp;&nbsp;<item&nbsp;name="android:colorPrimary">@color/colorPrimary</item> &nbsp;&nbsp;&nbsp;&nbsp;<item&nbsp;name="android:colorPrimaryDark">@color/colorPrimaryDark</item> &nbsp;&nbsp;&nbsp;&nbsp;<item&nbsp;name="android:colorAccent">@color/colorPrimary</item> &nbsp;</style>
随时随地看视频慕课网APP

相关分类

Android
我要回答