DatePickerDialog与主题霍洛灯? [英] DatePickerDialog with theme Holo Light?
问题描述
这怎么可能得到一个DatePickerDialog与全息光主题?
How is it possible to get a DatePickerDialog with Holo Light theme?
创建当 DatePickerDialog
如下:
DatePickerDialog dpd = new DatePickerDialog(new ContextThemeWrapper(this,
android.R.style.Theme_Holo_Light_Dialog_NoActionBar),
new DateListener(v), mTime.year, mTime.month, mTime.monthDay);
或主题 android.R.style.Theme_Holo_Light
或 android.R.style.Theme_Holo_Light_Dialog
,我得到日期选择器与一个标准的标题和标准按钮。我试图用一个自定义主题带有全息光父母也一样,但它也不能工作。这似乎与主题工作 android.R.style.Theme_Holo
,但结果却是一个黑暗的背景(如预期),但我想有一个轻的。
or with theme android.R.style.Theme_Holo_Light
or android.R.style.Theme_Holo_Light_Dialog
, I get a date picker with a standard title and standard buttons. I tried to use a custom theme with a holo light parent too, but it didn't work either. It seems to work with theme android.R.style.Theme_Holo
, but the result is a dark background (as expected), but I would like to have a light one.
应用程序的的android.jar是14版本,应用程序与Android 3.2版本的divice运行。
The application's android.jar is of version 14, the application is running on a divice with android version 3.2.
我在这里看到的一个例子:<一href="http://as400sample$c$c.blogspot.com/2011/10/android-datepickerdialog.html">http://as400sample$c$c.blogspot.com/2011/10/android-datepickerdialog.html,这显示了 DatePickerDialog
与全息光的主题,我想办法把它。我不知道为什么它不符合我的设置工作。
I have seen an example here: http://as400samplecode.blogspot.com/2011/10/android-datepickerdialog.html, which shows a DatePickerDialog
with the holo light theme, the way I would like to have it. I don't know why it doesn't work with my setup.
感谢您的帮助。
推荐答案
在 DatePickerDialog
有它接受一个主题构造
The DatePickerDialog
has a constructor which accepts a theme
DatePickerDialog(Context context, int theme, DatePickerDialog.OnDateSetListener callBack, int year, int monthOfYear, int dayOfMonth)
更新你的code,包括你想,而不需要一个 ContextThemeWrapper
DatePickerDialog dpd = new DatePickerDialog(this,
android.R.style.Theme_Holo_Light_Dialog_NoActionBar,
new DateListener(v), mTime.year, mTime.month, mTime.monthDay);
它的工作对我来说是这样。
It's working for me that way.
这篇关于DatePickerDialog与主题霍洛灯?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!