{"record":{"id":"a511d0c74fa15c2b","repo":"DrKLO/Telegram","slug":"providing-a-layouttransition-into-recyclerview-is","errorCode":null,"errorMessage":"Providing a LayoutTransition into RecyclerView is not supported. Please use setItemAnimator() instead for animating changes to the items in this RecyclerView","messagePattern":"Providing a LayoutTransition into RecyclerView is not supported\\. Please use setItemAnimator\\(\\) instead for animating changes to the items in this RecyclerView","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"TMessagesProj/src/main/java/androidx/recyclerview/widget/RecyclerView.java","lineNumber":2347,"sourceCode":"     * @return true if layout and scroll are frozen\n     *\n     * @deprecated Use {@link #isLayoutSuppressed()}.\n     */\n    @Deprecated\n    public boolean isLayoutFrozen() {\n        return isLayoutSuppressed();\n    }\n\n    /**\n     * @deprecated Use {@link #setItemAnimator(ItemAnimator)} ()}.\n     */\n    @Deprecated\n    @Override\n    public void setLayoutTransition(LayoutTransition transition) {\n        if (transition == null) {\n            super.setLayoutTransition(null);\n        } else {\n            throw new IllegalArgumentException(\"Providing a LayoutTransition into RecyclerView is \"\n                    + \"not supported. Please use setItemAnimator() instead for animating changes \"\n                    + \"to the items in this RecyclerView\");\n        }\n    }\n\n    /**\n     * Animate a scroll by the given amount of pixels along either axis.\n     *\n     * @param dx Pixels to scroll horizontally\n     * @param dy Pixels to scroll vertically\n     */\n    public void smoothScrollBy(@Px int dx, @Px int dy) {\n        smoothScrollBy(dx, dy, null);\n    }\n\n    /**\n     * Animate a scroll by the given amount of pixels along either axis.\n     *","sourceCodeStart":2329,"sourceCodeEnd":2365,"githubUrl":"https://github.com/DrKLO/Telegram/blob/45ab8f4308496e1f01026a97fcdb0d58a5274474/TMessagesProj/src/main/java/androidx/recyclerview/widget/RecyclerView.java#L2329-L2365","documentation":"RecyclerView overrides setLayoutTransition to forbid non-null LayoutTransition. RecyclerView animates children through ItemAnimator, and a ViewGroup LayoutTransition would conflict with the recycler's own add/remove/move bookkeeping, producing broken animations and crashes. Only null is accepted (to clear any inherited transition).","triggerScenarios":"Calling recyclerView.setLayoutTransition(someTransition) programmatically. Setting android:animateLayoutChanges=\"true\" on the RecyclerView in XML (which installs a default LayoutTransition). Applying a layout transition via a shared style/theme.","commonSituations":"Copy-pasting android:animateLayoutChanges=\"true\" from another ViewGroup into the RecyclerView. Programmatically applying a global transition to all ViewGroups in a hierarchy walk.","solutions":["Remove android:animateLayoutChanges=\"true\" from the RecyclerView element in XML.","Do not call setLayoutTransition on a RecyclerView; use setItemAnimator(DefaultItemAnimator) for change animations.","Call recyclerView.setLayoutTransition(null) defensively if a theme/style injects one."],"exampleFix":"<!-- before -->\n<androidx.recyclerview.widget.RecyclerView\n    android:animateLayoutChanges=\"true\" .../>\n\n<!-- after -->\n<androidx.recyclerview.widget.RecyclerView .../> <!-- no animateLayoutChanges -->","handlingStrategy":"validation","validationCode":"// Never call setLayoutTransition(non-null) on a RecyclerView.\n// If a theme may inject one, clear it explicitly:\nrecyclerView.setLayoutTransition(null);","typeGuard":"null","tryCatchPattern":"null","preventionTips":["Do not set android:animateLayoutChanges on a RecyclerView.","Use DefaultItemAnimator via setItemAnimator for change animations.","If a shared style injects a transition, override with setLayoutTransition(null) after inflation."],"tags":["recyclerview","itemanimator","layout-transition","configuration"],"backgroundTag":null,"analyzedSha":"45ab8f4308496e1f01026a97fcdb0d58a5274474","analyzedAt":"2026-08-14T05:19:30.815Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}