{"record":{"id":"4e2466163b65eccb","repo":"Tencent/QMUI_Android","slug":"adjustviewbounds","errorCode":null,"errorMessage":"不支持adjustViewBounds","messagePattern":"不支持adjustViewBounds","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"qmui/src/main/java/com/qmuiteam/qmui/widget/QMUIRadiusImageView.java","lineNumber":139,"sourceCode":"        }\n\n        mIsTouchSelectModeEnabled = array.getBoolean(\n                R.styleable.QMUIRadiusImageView_qmui_is_touch_select_mode_enabled, true);\n        mIsCircle = array.getBoolean(R.styleable.QMUIRadiusImageView_qmui_is_circle, false);\n        if (!mIsCircle) {\n            mIsOval = array.getBoolean(R.styleable.QMUIRadiusImageView_qmui_is_oval, false);\n        }\n        if (!mIsOval) {\n            mCornerRadius = array.getDimensionPixelSize(\n                    R.styleable.QMUIRadiusImageView_qmui_corner_radius, 0);\n        }\n        array.recycle();\n    }\n\n    @Override\n    public void setAdjustViewBounds(boolean adjustViewBounds) {\n        if (adjustViewBounds) {\n            throw new IllegalArgumentException(\"不支持adjustViewBounds\");\n        }\n    }\n\n    public void setBorderWidth(int borderWidth) {\n        if (mBorderWidth != borderWidth) {\n            mBorderWidth = borderWidth;\n            invalidate();\n        }\n    }\n\n    public void setBorderColor(@ColorInt int borderColor) {\n        if (mBorderColor != borderColor) {\n            mBorderColor = borderColor;\n            invalidate();\n        }\n    }\n\n    public void setCornerRadius(int cornerRadius) {","sourceCodeStart":121,"sourceCodeEnd":157,"githubUrl":"https://github.com/Tencent/QMUI_Android/blob/026e7d486677d6593a96689cd590ec3561176717/qmui/src/main/java/com/qmuiteam/qmui/widget/QMUIRadiusImageView.java#L121-L157","documentation":"QMUIRadiusImageView computes its rounded-corner/circle shape from the exact measured dimensions, which is incompatible with ImageView's adjustViewBounds scaling. Overriding setAdjustViewBounds, it throws IllegalArgumentException if you try to enable it (disabling is silently allowed).","triggerScenarios":"Calling setAdjustViewBounds(true) on a QMUIRadiusImageView, or inflating its XML with android:adjustViewBounds=\"true\".","commonSituations":"Copying layout XML from a plain ImageView, or a designer-requested 'fit width' behavior applied to an avatar/border image that must stay circular.","solutions":["Remove android:adjustViewBounds=\"true\" from the XML and drop setAdjustViewBounds(true) calls.","Use scaleType (e.g. centerCrop or fitCenter) instead of adjustViewBounds for scaling.","Constrain the view size with layout_width/height or fixed dp dimensions so rounding works.","If dynamic sizing is required, use a plain ImageView with a rounded outline (ViewOutlineProvider) instead of QMUIRadiusImageView."],"exampleFix":"// before\n<com.qmuiteam.qmui.widget.QMUIRadiusImageView\n    android:adjustViewBounds=\"true\" ... />\n// after\n<com.qmuiteam.qmui.widget.QMUIRadiusImageView\n    android:scaleType=\"centerCrop\"\n    app:qmui_corner_radius=\"8dp\" ... />","handlingStrategy":"validation","validationCode":"// only call when you intend to disable (false is accepted)\nif (adjustViewBounds) {\n    throw new IllegalArgumentException(\"QMUIRadiusImageView does not support adjustViewBounds\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    imageView.setAdjustViewBounds(true);\n} catch (IllegalArgumentException e) {\n    imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);\n}","preventionTips":["Never set android:adjustViewBounds on QMUIRadiusImageView in XML or code.","Use scaleType for scaling behavior on this view.","Give the view fixed or constrained dimensions so corner rounding works.","Search layouts for adjustViewBounds when migrating plain ImageViews to QMUIRadiusImageView."],"tags":["android","qmui","imageview","unsupported-operation"],"backgroundTag":"unsupported-operation","analyzedSha":"026e7d486677d6593a96689cd590ec3561176717","analyzedAt":"2026-09-06T13:32:24.816Z","contentChangedAt":"2026-09-06T13:32:24.816Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}