They are set by default when the text field is on error state, but can be disabled by setting the error icon drawable to null via the errorIconDrawable attribute or the setErrorIconDrawable method.
PiperOrigin-RevId: 260495196
Also updating clear text end icon to be not checkable, so that screen readers don't announce the icon's checked state as it's not relevant (differently from the password toggle icon, for example).
PiperOrigin-RevId: 259532643
An AutoCompleteTextView should be used in the place of a TextInputEditText, along with with a Widget.MaterialComponents.TextInputLayout.(...).ExposedMenuDropdown style.
PiperOrigin-RevId: 246343749
For that reason, users should opt to use the start icon API instead of setting a start/left compound drawable on the text field's edit text.
PiperOrigin-RevId: 238984066
A user-specified icon can now be set via app:endIconMode="custom" and attributes app:endIconDrawable and app:endIconContentDescription. It is also possible to set a custom OnClickListener via TextInputLayout's end icon API.
PiperOrigin-RevId: 234671237
Use the EditText's background for the filled box text field and a MaterialShapeDrawable drawn to the canvas for the underline. This allows for many improvements to the filled text field.
This commit:
- Fixes the underline flakiness, where the underline used to not meet the edges until drawableStateChanged() was called after a layout pass (because TextInputLayout was attempting to use EditText's pre-existing underline, and the bounds of that Drawable weren't known in order to modify them until after drawableStateChanged())
- Removes the hard-coded box offset since it was only necessary when trying to use EditText's background drawable
- Brings the expanded label/hint a bit closer to the vertical center. Any more than this will require changing the bounds set on the expanded hint text and create misalignment between the expanded hint and any compound drawable that might be set
Specs: https://material.io/design/components/text-fields.html#spec
There is a possible alternative to drawing the underline manually: including the underline as part of the EditText's background. I investigated this option and rejected it, since it would require a re-architecture of the way TextInputLayout handles the box logic and many layers of box drawable nesting. It is much more straightforward and performant to draw the underline directly to the canvas than to convert the boxBackground to {LayerDrawable{MaterialShapeDrawable,{InsetDrawable{MaterialShapeDrawable}}}}.
This commit should only change the visuals of the filled text field; the outline text field should be visually untouched.
PiperOrigin-RevId: 231246920
The outline box styles previously didn't allow a custom drawable to be set. The box background was handled by TextInputLayout, which nulled out the EditText's background and drew the boxBackground directly to the canvas. That meant that a call to TextInputEditText#setBackground() would not actually do anything - it would result in the same outline text field.
In order to respect the background drawable, TextInputEditText's background is set to null in the style. Then, TextInputLayout programmatically sets the custom outline drawable if the background is already null. This avoids overwriting a drawable that may have already been set on the TextInputEditText.
This change does pretty much nothing to the filled box style; since the EditText's underline is still being used, the background of the EditText was never set to null for that style. This change should be a no-op for that style.
This move to using the EditText's background for the outline also improves the bounds of the outline text field and gets rid of the cutoff that was appearing at the top of the outline when TextInputLayout's hint was disabled and a hint was set on the EditText.
PiperOrigin-RevId: 230538561
Also clarify the counter description when the limit is not exceeded. Instead of "3/10" it now reads "Characters entered 3 of 10."
Before this change, the counter would read out incorrect character lengths when focused on -- since the live region was set to ACCESSIBILITY_LIVE_REGION_POLITE, it wouldn't be incorrectly read out to the user unless they explored by touch, but if the user were to tap the counter view, it would read out an incorrect character length. This commit fixes that by updating the counter description at the appropriate point when the character count is updated.
PiperOrigin-RevId: 221671905
Update the type within TextInputLayout create color attributes for each element in order to ensure that the colors can be set outside of our typescale. The colors set in those new attributes are intended to be visual no-ops; the goal of this change is not to update the colors.
PiperOrigin-RevId: 219726813