简体   繁体   中英

android - CardView resize animation in RecyclerView

I have a RecyclerView with CardView as item in it. CardView has the Arrow icon to show details in the same CardView, but I don't want to set is GONE or VISIBLE because this action has no good looking animation. I tried to set android:animateLayoutChanges="true" on my CardView and I got this: (this is not my screen but it contains the same problem)

在此处输入图片说明

But once I click on the arrow again to collapse the supporting text, the card below overlaps the card I've clicked during the animation. How can I avoid this overlapping? I tried to call TransitionManager.beginDelayedTransition(CardView); but looks like it doesn't help me..

You can try removing android:animateLayoutChanges="true" and calling TransitionManager.beginDelayedTransition(MainRootView); (note that call parameter is RootView and not CardView).

If it wouldn't do you should do collapsing-expanging by your own. Here is a good example of view height animating.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM