我要如何改变一个TimePicker的文字颜色

我要如何改变一个TimePicker的文字颜色

本文介绍了Android的 - 我要如何改变一个TimePicker的文字颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是TimePicker与的backgroundColor =黑色一个LinearLayout中,但是,我不能看到TimePicker的数字,而我需要的背景色设置为黑色,在布局,我怎么可以改变文字颜色的该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>

我试图将它们分配为风格的TimePicker,但Widget.TimePicker和Widget.Holo.TimePicker父样式不能在Android的认可,我使用的:

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!

推荐答案

您应该使用样式在布局太:

You should use the style in your layout too:

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

当然,你必须创建两个布局,同时使用主题(API级别小于11或大于11),或在两个不同的值时─文件夹中创建自己的风格(价值和价值观-11;参考Android的文档)。

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).

这篇关于Android的 - 我要如何改变一个TimePicker的文字颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-06 00:05