Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

addSharedElement not work when using add #52

Open
DanteAndroid opened this issue Mar 15, 2017 · 5 comments
Open

addSharedElement not work when using add #52

DanteAndroid opened this issue Mar 15, 2017 · 5 comments

Comments

@DanteAndroid
Copy link

DanteAndroid commented Mar 15, 2017

                Fragment fragment = ViewerFragment.newInstance(diary.getPhotoUrl());
                fragment.setSharedElementEnterTransition(new ChangeBounds());
                getFragmentManager().beginTransaction()
                        .hide(this)//either using hide or not won't work
                        .add(R.id.container, fragment)// it work when using replace 
                        .addToBackStack("")
                        .addSharedElement(attachPicture, attachPicture.getTransitionName())
                        .commit();

Could you tell me why is that? Because I read the document of addSharedElement, it says:

Used with custom Transitions to map a View from a removed or hidden Fragment to a View from a shown or added Fragment.

@lgvalle
Copy link
Owner

lgvalle commented Mar 15, 2017

I have no idea sorry. Maybe because when you call add you are adding a new fragment instance, so your shared element can be referencing a view in the old one?

@DanteAndroid
Copy link
Author

I don't get you. When I use replace it works. The view is always referencing in the old one.
I think it's a bug. Now I use Activity with sharedElement and works well.
I think the document is clear enough, so... Don't you think?

@Lauzy
Copy link

Lauzy commented Aug 31, 2017

I have the same problem.
It seems like an official bug. It works When I use 'com.android.support:support-v4:25.1.0' and '24.2.1',but ‘25.3.1’ does not . Try to change the support version to 25.1.0 or other can be used.

@KishanViramgama
Copy link

I don't get you. When I use replace it works. The view is always referencing in the old one.
I think it's a bug. Now I use Activity with sharedElement and works well.
I think the document is clear enough, so... Don't you think?

Using replace it work fine

@PhantomLord72
Copy link

I have exact issues even with androidX. I have open a bug on issuetracker on google. Anyone have found a workaround?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants