2

I am unable to change background color of the layout in which ok and cancel buttons exist in timepickerdialog . What should I add or change .Also how can I change the textcolor of both ok and cancel buttons on timepickerdialog? I really appreciate any help.

My code:

<style name="Theme.MyTheme.TimePicker" parent="android:Widget.Material.Light.TimePicker">
    <item name="android:timePickerMode">clock</item>
    <item name="android:headerBackground">#ff555555</item>
    <item name="android:numbersTextColor">?android:attr/textColorPrimaryActivated</item>
    <item name="android:numbersInnerTextColor">?android:attr/textColorSecondaryActivated</item>
    <item name="android:numbersSelectorColor">?android:attr/colorControlActivated</item>
    <item name="android:numbersBackgroundColor">#ff555555</item>
    <item name="android:amPmTextColor">?android:attr/textColorSecondary</item>
</style>
jason
  • 3,932
  • 11
  • 52
  • 123
  • Check [http://stackoverflow.com/questions/26015798/change-timepicker-text-color](http://stackoverflow.com/questions/26015798/change-timepicker-text-color) – Chintan Rathod Sep 15 '15 at 09:21

1 Answers1

2

please try below code . hope it will help you

<style name="DialogTheme" parent="**Theme.AppCompat.Light**">
    <item name="colorAccent">@color/blue</item>
</style>

or you can try below code also

<style name="AppTheme" parent="...">
  ...
  <item name="android:timePickerDialogTheme">@style/AlertDialogCustom</item>
  <item name="android:datePickerDialogTheme">@style/AlertDialogCustom</item>
  <item name="android:alertDialogTheme">@style/AlertDialogCustom</item>
</style>

<style name="AlertDialogCustom" parent="android:Theme.Material.Light.Dialog.Alert">
  <item name="android:colorPrimary">#00397F</item>
  <item name="android:colorAccent">#0AAEEF</item>
</style>
  • but the background color behind the hr,mins and am/pm is different and header background is different .How can I control layout of hr,mins and am/pm on topbar ?? – jason Sep 15 '15 at 10:36
  • @drawable/line @color/blue Add above line in your style . it may help you –  Sep 16 '15 at 05:45