material-components / material-components/material-components-android

[MaterialDatePicker] Switch-To-Keyboard Input Toggle Icon Background Never Changes (Same as Tint Color)

Open
#3,438 1 comment 0 reactions 1 assignee View on GitHub

Nobody has claimed this yet.

bug Widget: DatePicker
Dominant language
Java
Stars
17.4k
Forks
3.2k
PR merge metrics
No merged PRs in 30d

Description

**Description:** With the source code provided below, I am not able to set so that the background of the switch-to-keyboard input toggle icon is different from the icon's tint (i.e., outline of the pencil is one color and the fill within the same is a different color)

**Expected behavior:** Tint applies to the pencil icon's outline color and Background applies to the pencil icon's shape fill color.

NOTE: It may be entirely possible here that I am misunderstanding the purpose of `Tint` and `Background` and what I am trying to achieve is simply not possible. If so, please let me know and sincere apologies for wasting time.

**Source code:**

In a module's styles.xml file, I have the following defined:
```

<item name="materialCalendarStyle">@style/Widget.MaterialComponents.MaterialCalendar</item>
<item name="materialCalendarFullscreenTheme">@style/ThemeOverlay.MaterialComponents.MaterialCalendar.Fullscreen</item>
<item name="materialCalendarTheme">@style/ThemeOverlay.MaterialComponents.MaterialCalendar</item>
<item name="materialCalendarHeaderToggleButton">@style/SomeFragmentDatePicker.InputTypeIcon</item>


<item name="android:background">@color/white</item>
<item name="android:tint">@color/green</item>

```

In my fragment:
```
if (datePickerDialog == null) {
datePickerDialog =
MaterialDatePicker.Builder.datePicker()
.setTheme(R.style.SomeFragmentDatePicker)
.setSelection(MaterialDatePicker.todayInUtcMilliseconds())
.build();
datePickerDialog.addOnPositiveButtonClickListener(
selection -> {
// TODO
});
}
datePickerDialog.show(getParentFragmentManager(), "SomeFragment");
```

**Android API version:** Android API 28 and 33

**Material Library version:** Material Android Library version 1.8.0

**Device:** Pixel 4, Pixel 6

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.