Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change Android DatePicker Dialog's "Dividers" Colors

I'm trying to create a custom dialog, basically I'm using DatePickerDialog.THEME_HOLO_DARK but I want to change the "divider" color and the text color.

enter image description here

I want to change the blue lines and the text color to red.

Thanks in advance!

EDIT:

Using this code:

<style name="testo" parent="@android:style/Widget.DeviceDefault.DatePicker">
    <item name="android:divider">@drawable/dialog_divider</item>
</style>

This is what I get: enter image description here

The drawable for the divider is basically a red line..

like image 727
Robin.v Avatar asked Oct 03 '12 14:10

Robin.v


People also ask

Is Date Picker dialogue class available in android?

Android Date Picker allows you to select the date consisting of day, month and year in your custom user interface. For this functionality android provides DatePicker and DatePickerDialog components.


2 Answers

You will have to create your own theme that extends THEME_HOLO_DARK. Change basic theme color of android application

Edit: Try something like this

<style name="testo" parent="@android:style/Widget.DeviceDefault.DatePicker">
    <item name="android:divider">@drawable/MyDivider</item>
</style>

And pass the reference to your theme to the constructor

like image 91
ahodder Avatar answered Oct 23 '22 13:10

ahodder


add this item to your main theme

<item name="numberPickerStyle">@style/MyApp.NumberPicker</item>

set custom divider color in this style

<style name="MyApp.NumberPicker" parent="Widget.Holo.NumberPicker">
   <item name="selectionDivider">@color/white</item>
</style>

EDIT : tested only on HoloEverywhere

like image 39
Oleg Koshkin Avatar answered Oct 23 '22 14:10

Oleg Koshkin