I have a RecyclerView
with some cards each containing a mini Floating Action Button. When a card is clicked, the image on the card and the fab are used in a shared element transition.
When doing the return transition, the floating action button "snaps" back into its original position, rather than animating nicely as its supposed to.
Heres a gif that shows the issue: https://gfycat.com/SnappySeparateDeer
My code starting the activity and transition:
Intent intent = new Intent(mContext, PlayActivity.class); Pair<View, String> p1 = Pair.create((View)holder.coverArt, "coverArt"); Pair<View, String> p2 = Pair.create((View) holder.fab, "fab"); ActivityOptionsCompat options = ActivityOptionsCompat. makeSceneTransitionAnimation(mActivity, p1, p2); mContext.startActivity(intent, options.toBundle());
the mini fab on the cards:
<android.support.design.widget.FloatingActionButton android:id="@+id/fab" app:fabSize="mini" android:layout_height="wrap_content" android:layout_width="wrap_content" app:layout_anchor="@id/coverArt" app:layout_anchorGravity="bottom|right|end" android:src="@drawable/ic_favorite" android:layout_margin="16dp" android:clickable="true" android:transitionName="fab"/>
and the one in the activity:
<android.support.design.widget.FloatingActionButton android:id="@+id/fab" android:layout_height="wrap_content" android:layout_width="wrap_content" app:layout_anchor="@id/coverArt" app:layout_anchorGravity="bottom|right|end" android:src="@drawable/ic_favorite" android:layout_margin="16dp" android:clickable="true" android:transitionName="fab"/>
EDIT: I'd like to increase the bounty but it seems that feature isnt implemented in SO for some reason. I'm pretty sure I can add additional bounty points to the correct answer, so will add another +50. Thanks!
0 comments:
Post a Comment