【问题标题】:Android: change TimePickerDialog picker (circle) background colorAndroid:更改 TimePickerDialog 选择器(圆形)背景颜色
【发布时间】:2018-12-27 21:52:05
【问题描述】:

有没有办法改变下面标记的背景颜色?

到目前为止,我设法改变了这样的背景颜色:

<style name="DialogTheme" parent="Theme.MaterialComponents.DayNight.Dialog" >
    <item name="android:backgroundTint">#141414</item>
</style>

并像这样应用它:

TimePickerDialog timePickerDialog = new TimePickerDialog(getActivity(), R.style.DialogTheme, listener, hour, minute, false);

我正在运行 Android Pie。

【问题讨论】:

标签: android android-dialog android-timepicker


【解决方案1】:

通过更改numbersBackgroundColor 属性

<style name="MyTimePickerWidgetStyle" 
 parent="@android:style/Widget.Material.TimePicker">
<item name="android:headerBackground">#ffe082</item>
<item name="android:numbersTextColor">#b71c1c</item>
<item name="android:numbersInnerTextColor">#f44336</item>
<item name="android:numbersSelectorColor">#33691e</item>
<item name="android:numbersBackgroundColor">#ef9a9a</item>
<item name="android:amPmTextColor">#9c27b0</item>

希望有效果

【讨论】:

  • 使用您的建议将导致一个全屏对话框,其中 TimePicker 与屏幕顶部对齐,但没有任何指定的颜色。我尝试将 numbersBackgroundColor 属性添加到我的样式中,但它并没有改变任何东西。
猜你喜欢
  • 2014-11-05
  • 2018-03-04
  • 2020-03-27
  • 2014-02-11
  • 2021-07-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-12-30
相关资源
最近更新 更多