{"record":{"id":"6f66f05dcd84f285","repo":"material-components/material-components-android","slug":"the-current-box-background-mode-is-not-supported","errorCode":null,"errorMessage":"The current box background mode  is not supported by the end icon mode ","messagePattern":"The current box background mode  is not supported by the end icon mode ","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"lib/java/com/google/android/material/textfield/EndCompoundLayout.java","lineNumber":382,"sourceCode":"    return endIconMode;\n  }\n\n  void setEndIconMode(@EndIconMode int endIconMode) {\n    if (this.endIconMode == endIconMode) {\n      return;\n    }\n    tearDownDelegate(getEndIconDelegate());\n    int previousEndIconMode = this.endIconMode;\n    this.endIconMode = endIconMode;\n    dispatchOnEndIconChanged(previousEndIconMode);\n    setEndIconVisible(endIconMode != END_ICON_NONE);\n    EndIconDelegate delegate = getEndIconDelegate();\n    setEndIconDrawable(getIconResId(delegate));\n    setEndIconCheckable(delegate.isIconCheckable());\n    if (delegate.isBoxBackgroundModeSupported(textInputLayout.getBoxBackgroundMode())) {\n      setUpDelegate(delegate);\n    } else {\n      throw new IllegalStateException(\n          \"The current box background mode \"\n              + textInputLayout.getBoxBackgroundMode()\n              + \" is not supported by the end icon mode \"\n              + endIconMode);\n    }\n    setEndIconOnClickListener(delegate.getOnIconClickListener());\n    setEndIconContentDescription(delegate.getIconContentDescriptionResId());\n    if (editText != null) {\n      delegate.onEditTextAttached(editText);\n      setOnFocusChangeListenersIfNeeded(delegate);\n    }\n    applyIconTint(textInputLayout, endIconView, endIconTintList, endIconTintMode);\n    refreshIconState(/* force= */ true);\n  }\n\n  void refreshIconState(boolean force) {\n    boolean stateChanged = false;\n    EndIconDelegate delegate = getEndIconDelegate();","sourceCodeStart":364,"sourceCodeEnd":400,"githubUrl":"https://github.com/material-components/material-components-android/blob/ac7e18efeefb331850c561faf9ab8bf81d27ba68/lib/java/com/google/android/material/textfield/EndCompoundLayout.java#L364-L400","documentation":"EndCompoundLayout.setEndIconMode checks each EndIconDelegate's supported box background modes (isBoxBackgroundModeSupported). For example, the dropdown-menu delegate is only supported with filled/outlined box backgrounds, not BOX_BACKGROUND_NONE. When the TextInputLayout's current box background mode is unsupported for the requested end icon mode, it throws IllegalStateException naming both values.","triggerScenarios":"setEndIconMode(END_ICON_DROPDOWN_MENU) (or app:endIconMode=\"dropdown_menu\") while the TextInputLayout uses boxBackgroundMode none (plain underline style); password-toggle/custom icons on unsupported box modes.","commonSituations":"Enabling dropdown menu on a default (non-box) TextInputLayout style instead of an ExposedDropdownMenu style; changing app:boxBackgroundMode at runtime after setting the end icon mode.","solutions":["Use the matched style, e.g. Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu / Widget.Material3.TextInputLayout.*.ExposedDropdownMenu.","Or set the box background mode to filled/outlined before enabling the dropdown end icon: setBoxBackgroundMode(BOX_BACKGROUND_OUTLINE).","Keep the end icon mode consistent with the layout style (no dropdown icon on underline-only layouts)."],"exampleFix":"<!-- before -->\n<com.google.android.material.textfield.TextInputLayout\n    app:endIconMode=\"dropdown_menu\"> <!-- default box mode = none -> throws -->\n\n<!-- after -->\n<com.google.android.material.textfield.TextInputLayout\n    style=\"@style/Widget.Material3.TextInputLayout.OutlinedBox.ExposedDropdownMenu\">","handlingStrategy":"validation","validationCode":"// Dropdown end icon requires a box background (filled/outlined):\nint box = til.getBoxBackgroundMode();\nboolean boxOk = box == TextInputLayout.BOX_BACKGROUND_FILLED\n    || box == TextInputLayout.BOX_BACKGROUND_OUTLINE;\nif (boxOk) til.setEndIconMode(TextInputLayout.END_ICON_DROPDOWN_MENU);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use the ExposedDropdownMenu TextInputLayout styles instead of mixing attributes by hand.","If setting modes in code, set the box background mode before the dropdown end icon mode.","Never combine dropdown end icon with underline (BOX_BACKGROUND_NONE) layouts."],"tags":["textinputlayout","dropdown","box-background-mode","android"],"backgroundTag":null,"analyzedSha":"ac7e18efeefb331850c561faf9ab8bf81d27ba68","analyzedAt":"2026-08-14T15:35:35.735Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}