简体   繁体   中英

Android: change TimePickerDialog picker (circle) background color

Is there any way of changing the background color marked bellow? 在此处输入图片说明

Until now I managed to change the background color like this:

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

and applied it like this:

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

I'm running Android Pie.

by change numbersBackgroundColor attribute

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

Hope it works

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM