Material-components-android: [MaterialTimePicker] Can't customize styling for newly released timePicker

Created on 10 Sep 2020  路  3Comments  路  Source: material-components/material-components-android

Description:

Hi, I'm testing out the newly released MaterialTimePicker and trying couple ways to customize styling without any success,

I tried something like following:

item name="materialTimePickerTheme">@style/MyTimePickerDialogStyle // in app theme

<style name="MyTimePickerDialogStyle" parent="@style/Widget.MaterialComponents.TimePicker"> <item name="colorControlActivated">?attr/colorSecondary</item> <item name="colorAccent">?attr/colorPositiveButton</item> </style>

Wondering if customize styling is supported or not, where can I find a doc for the attributes I can use to customize?

Thank you!

Expected behavior: Screenshots and/or description of expected behavior

Android API version: Any

Material Library version: 1.3.0-alpha02

Device: Any

To help us triage faster, please check to make sure you are using the latest version of the library.

We also happily accept pull requests.

bug

Most helpful comment

No problem!

  1. Not for now, I'll check with design if that should be supported.

  2. I was just working on that, so it should be coming soon.

  3. I'm not sure. Adding a dimen resource mtrl_btn_stroke_size with 0dp value or a color resource material_timepicker_button_stroke with value transparent to your App could work. The stroke is important for Accessibility so I'm not convinced we should have an easy to remove it. Let get back to you on that one.

All 3 comments

Hi there, Material Theme doesn't really use colorAccent.

https://github.com/material-components/material-components-android/blob/master/docs/theming/Color.md

The documentation should be coming.

In the meantime these are the colors that we're supposed to be using. Notice it's primary, onSurface, surface, onPrimary and others.

Screen Shot 2020-09-10 at 2 15 47 PM

@ymarian thanks for the quick reply and that helps. Couple follow-up questions:

  1. Is there a way to customize the background color, e.g. the clock (change onSurface will also affect the hour text color)
  2. Is there a way to hide the title? SELECT TIME
  3. is there a way to take out am/pm boarders?
    Screen Shot 2020-09-10 at 11 36 31 AM

No problem!

  1. Not for now, I'll check with design if that should be supported.

  2. I was just working on that, so it should be coming soon.

  3. I'm not sure. Adding a dimen resource mtrl_btn_stroke_size with 0dp value or a color resource material_timepicker_button_stroke with value transparent to your App could work. The stroke is important for Accessibility so I'm not convinced we should have an easy to remove it. Let get back to you on that one.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

JavierSegoviaCordoba picture JavierSegoviaCordoba  路  3Comments

sepehr-alipour picture sepehr-alipour  路  3Comments

KelvinPac picture KelvinPac  路  3Comments

ataulm picture ataulm  路  3Comments

aarontwf picture aarontwf  路  3Comments