question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Motion layout(alpha4) issue with recyclerview onswipe item

See original GitHub issue

I am using alpha4 implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha4' of constraint layout. First I created a single layout and do onswipe animation it is working perfectly with motion layout then I patched the layout with a recyclerview. Now problem comes into picture Issue:

  1. If I am doing onswipe in a particular item of rv then it’s getting lagged.
  2. Suppose I am doing swipe on the 1st item of the rv now after full swipe you will find that same swiped has already happen with 13th no item, 25th no item and so on. So after every 12 item same swipe you can check while you are scrolling.

I have posted the whole project in Github and also created a sample video.

For quick gist of motion layout here is the link. And here is the layout desc link.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:5

github_iconTop GitHub Comments

4reactions
pom1004commented, Apr 26, 2019

Finally the issue is fixed by one of colleague. @Srini Thanks for the solution.

 @Override
    public int getItemViewType(int position) {

        return position;
    }

Just need to override this method in adapter of recyclerview.

[Note:]Still the lag is there while swiping.

1reaction
melihaksoycommented, May 10, 2019

About how to reset - yes, right on point, constraint set would solve it easy.

I don’t know if it’d solve the frame drops, I didn’t really experiment with MotionLayout in RecyclerView. What you can do is get a systrace to see what’s causing frame drops. If it’s MotionLayout related then you can create a new issue with the information you have 👍.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Motion layout(alpha4) issue with recyclerview onswipe item
I am using alpha4 implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha4' of constraint layout. First I created a single layout ...
Read more >
[MotionLayout] Recyclerview inside ... - Issue Tracker
When a RecyclerView is inside a MotionLayout, it does not update its items on `notifyDataSetChanged()` and the `onBindViewHolder` method is not called. However, ......
Read more >
ItemTouchHelper.Callback - Android Developers
If user drags an item, ItemTouchHelper will call onMove(recyclerView, dragged, target) . Upon receiving this callback, you should move the item from the...
Read more >
RecyclerView scrolling issue in android MotionLayout-kotlin
You should determine two transition one startToEnd one endToStart after that add keyAttribute for things that is alpha zero like this
Read more >
MotionLayout with RecycleView tutorial Android (2021)
Android # MotionLayout #RecycleViewIn this video I'll show you how to use RecycleView as MotionLayout onSwipe trigger.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found