{"record":{"id":"b733a79d96a7cf78","repo":"material-components/material-components-android","slug":"invalid-view-edge-position-value","errorCode":null,"errorMessage":"Invalid view edge position value: ","messagePattern":"Invalid view edge position value: ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"lib/java/com/google/android/material/behavior/HideViewOnScrollBehavior.java","lineNumber":192,"sourceCode":"  public void setViewEdge(@ViewEdge int viewEdge) {\n    viewEdgeOverride = true;\n    setViewEdgeInternal(viewEdge);\n  }\n\n  private void setViewEdgeInternal(@ViewEdge int viewEdge) {\n    if (hideOnScrollViewDelegate == null || hideOnScrollViewDelegate.getViewEdge() != viewEdge) {\n      switch (viewEdge) {\n        case EDGE_RIGHT:\n          this.hideOnScrollViewDelegate = new HideRightViewOnScrollDelegate();\n          break;\n        case EDGE_BOTTOM:\n          this.hideOnScrollViewDelegate = new HideBottomViewOnScrollDelegate();\n          break;\n        case EDGE_LEFT:\n          this.hideOnScrollViewDelegate = new HideLeftViewOnScrollDelegate();\n          break;\n        default:\n          throw new IllegalArgumentException(\n              \"Invalid view edge position value: \"\n                  + viewEdge\n                  + \". Must be \"\n                  + EDGE_RIGHT\n                  + \", \"\n                  + EDGE_BOTTOM\n                  + \" or \"\n                  + EDGE_LEFT\n                  + \".\");\n      }\n    }\n  }\n\n  private boolean isGravityBottom(int viewGravity) {\n    return viewGravity == Gravity.BOTTOM || (viewGravity == (Gravity.BOTTOM | Gravity.CENTER));\n  }\n\n  private boolean isGravityLeft(int viewGravity) {","sourceCodeStart":174,"sourceCodeEnd":210,"githubUrl":"https://github.com/material-components/material-components-android/blob/ac7e18efeefb331850c561faf9ab8bf81d27ba68/lib/java/com/google/android/material/behavior/HideViewOnScrollBehavior.java#L174-L210","documentation":"HideViewOnScrollBehavior selects an internal delegate (HideRightViewOnScrollDelegate, HideBottomViewOnScrollDelegate, or HideLeftViewOnScrollDelegate) from the view edge attribute. Only EDGE_RIGHT, EDGE_BOTTOM, and EDGE_LEFT are valid; any other value falls through the switch and throws IllegalArgumentException naming the accepted constants.","triggerScenarios":"Constructing HideViewOnScrollBehavior(context, attrs) where the XML behavior attribute for the edge is set to an unrecognized/unset value; or calling the internal edge-setting path programmatically with a constant other than EDGE_RIGHT/EDGE_BOTTOM/EDGE_LEFT.","commonSituations":"Hand-editing the behavior XML attributes and typos or removes the edge value; library version change that introduced/renamed edge constants while the app still passes an old custom int; programmatically passing 0 or an arbitrary int because the constant was not imported.","solutions":["Set the edge attribute to one of the documented constants: EDGE_RIGHT, EDGE_BOTTOM, or EDGE_LEFT.","If set in code, reference the class constants (e.g. HideViewOnScrollBehavior.EDGE_BOTTOM) instead of raw ints.","After upgrading Material Components, re-check the edge attribute values for renames and update the XML."],"exampleFix":"<!-- before -->\n<item name=\"behavior_hideOnScrollViewEdge\">3</item> <!-- invalid raw value -->\n\n<!-- after -->\n<item name=\"behavior_hideOnScrollViewEdge\">bottom</item> <!-- valid edge -->","handlingStrategy":"validation","validationCode":"int edge = HideViewOnScrollBehavior.EDGE_BOTTOM; // one of EDGE_RIGHT/EDGE_BOTTOM/EDGE_LEFT only\nboolean valid = edge == HideViewOnScrollBehavior.EDGE_RIGHT\n    || edge == HideViewOnScrollBehavior.EDGE_BOTTOM\n    || edge == HideViewOnScrollBehavior.EDGE_LEFT;","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Reference class constants instead of raw ints in XML or code.","Re-verify edge attribute values after every Material Components upgrade."],"tags":["behavior","hide-on-scroll","illegal-argument","xml-configuration"],"backgroundTag":null,"analyzedSha":"ac7e18efeefb331850c561faf9ab8bf81d27ba68","analyzedAt":"2026-08-14T15:35:35.735Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}