问题描述
我想创建一个 DialogFragment
或一个 Dialog
和一个 TimePicker
里面,就像下面的图片一样。问题是我的应用程序使用了 Holo.Light
主题,然后从那里开始对其进行自定义,但是找不到与<$ c $相关的任何东西c> TimePicker 。
I'd like to create a DialogFragment
or a Dialog
with a TimePicker
inside, just like in the following image. The problem is that my application is using the Holo.Light
theme and then from there, I'm customizing it, but I can't find anything related to TimePicker
.
是否可以为 TimePicker
分配自定义样式?我没有在Android的官方文档中找到任何内容。
Is it possible to assign a custom style to a TimePicker
? I haven't found anything in the official Android documentation.
下面的图像是到目前为止的内容,但仍然是 TimePicker
不是我想要的颜色(与标题分隔符中的橙色相同),甚至在XML中也是如此,如下所示:
The following image is what I got so far, but still the TimePicker
isn't in the color I want (it's the same orange as in the separator of the title) even tho in the XML I have it as it follows:
<TimePicker
android:id="@+id/picker"
style="@style/Checkmark"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dip" />
有什么想法吗?
提前谢谢
Any ideas, please?Thanks a lot in advance
推荐答案
我在HoloEverywhere中使用在android 2.2及更高版本中具有本地Holo元素。如果使用此库,因为它是开源的,并且可以完全访问代码,因此可以轻松设置选择器的样式。
I use HoloEverywhere https://github.com/Prototik/HoloEverywhere to have native Holo elements in android 2.2 and up. You can style the picker easily if you use this library since it's open source and you get full access to the code.
可能不需要整个库,它最好只获取TimePicker元素(谨防依赖地狱)
Probably you don't need the whole library, it might be good to get only the TimePicker elements (beware of the dependency hell)
这篇关于在Android中使用自定义样式创建TimePickerDialog的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!