Skip to content
This repository was archived by the owner on Dec 27, 2024. It is now read-only.
This repository was archived by the owner on Dec 27, 2024. It is now read-only.

MotionLayout bug with Recyclerview ( setTransition programmatically and back, Recyclerview Scroll did not attach to MotionLayout OnSwipe ) #849

@aadilmirrani

Description

@aadilmirrani

ConstraintLayout version: 2.1.4
Recyclerview: 1.3.1

In my Android app. I have a layout consisting of an ImageView and a NestedScrollView within a ConstraintLayout. The layout is designed with three ConstraintSet states: constraints_start, constraints_end, and constraints_search.

I have set up a transition between constraints_start and constraints_end, which is triggered by a swipe gesture on the header or NestedScrollView. The XML for this transition is as follows:



The issue I'm facing is that when I programmatically set the transition state using setTransition or transitionToState, the NestedScrollView seems to scroll on its own, and the MotionLayout transition doesn't trigger immediately. However, it works as intended if I manually scroll on the header after setting the transition programmatically.

Steps to Reproduce:

Programmatically set the transition state using setTransition or transitionToState.
Observe that the NestedScrollView starts scrolling on its own.
Manually scroll on the header
After the manual scroll, the MotionLayout transition triggers as expected.
Expected Behavior:

The MotionLayout transition should be triggered programmatically without the need for a manual scroll on the header or NestedScrollView.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions