Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android - How do I change the textColor in a TimePicker?

I'm using a TimePicker into a LinearLayout with backgroundColor = black, however, I can't see the numbers in the TimePicker, and I need the background color set to black in the layout, how can I change the textColor in the TimePicker? I already tried this with no luck:

<style name="MyTimePicker" parent="@android:style/Widget.TimePicker">
    <item name="android:textColor">#000000</item>
</style>

<style name="MyHoloTimePicker" parent="@android:style/Widget.Holo.TimePicker">
    <item name="android:textColor">#000000</item>
</style>

I tried to assign them as styles in the TimePicker, but the Widget.TimePicker and Widget.Holo.TimePicker parent styles are not recognized in Android, I'm using:

android:minSdkVersion="8"

Could you help me out please? thank you!

like image 292
saman0suke Avatar asked Feb 09 '14 17:02

saman0suke


1 Answers

You should use the style in your layout too:

<TimePicker
   style="@style/MyHoloTimePicker"
   android:layout_width="fill_parent"
   android:layout_height="fill_parent" />

Of course you'll have to create two layouts to use both themes (API level less than 11 or greater than 11), or create your style in two different values- folders ("values" and "values-11"; refer to Android documentation).

like image 101
ialfa1987 Avatar answered Oct 05 '22 04:10

ialfa1987