gpt4 book ai didi

android - 主题为 Holo Light 的 DatePickerDialog?

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:21:12 26 4
gpt4 key购买 nike

如何获得带有 Holo Light 主题的 DatePickerDialog?

创建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_Lightandroid.R.style.Theme_Holo_Light_Dialog,我得到一个带有标准标题和标准按钮的日期选择器。我也尝试将自定义主题与全息灯父项一起使用,但它也没有用。它似乎适用于主题 android.R.style.Theme_Holo,但结果是深色背景(正如预期的那样),但我想要浅色背景。

该应用程序的android.jar 版本为14,该应用程序运行在android 版本为3.2 的设备上。

我在这里看到了一个例子:http://as400samplecode.blogspot.com/2011/10/android-datepickerdialog.html ,它显示了一个带有全息灯主题的 DatePickerDialog,这是我想要的方式。我不知道为什么它不适用于我的设置。

谢谢你的帮助。

最佳答案

DatePickerDialog 有一个接受主题的构造函数

DatePickerDialog(Context context, int theme, DatePickerDialog.OnDateSetListener callBack, int year, int monthOfYear, int dayOfMonth)

只需更新您的代码以包含您想要的样式,而无需 ContextThemeWrapper

DatePickerDialog dpd = new DatePickerDialog(this,
android.R.style.Theme_Holo_Light_Dialog_NoActionBar,
new DateListener(v), mTime.year, mTime.month, mTime.monthDay);

我就是这样工作的。

关于android - 主题为 Holo Light 的 DatePickerDialog?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9278780/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com