I have a layout like in the picture below

where the orange HostFragment frame HostFragment constructed as follows:
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@id/coordinator" android:layout_width="match_parent" android:layout_height="match_parent" > <android.support.design.widget.AppBarLayout android:id="@id/appbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> <android.support.v7.widget.Toolbar android:id="@id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" app:layout_scrollFlags="scroll|enterAlways" app:popupTheme="@style/ThemeOverlay.AppCompat.Light" app:titleMarginStart="68dp" /> <de.halfbit.audiopie.ui.common.views.SlidingTabs android:id="@id/tabs" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" app:slidingTabsIndicatorColor="@color/accent" /> </android.support.design.widget.AppBarLayout> <android.support.v4.view.ViewPager android:id="@id/pager" android:layout_width="match_parent" android:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior" /> </android.support.design.widget.CoordinatorLayout>
and the blue frame is a child ItemsFragment with a RecyclerView in it.
When I click on a tile in RecyclerView , I replace HostFragment with another ContentFragment fragment, which, suppose, should share a click on the image. I do this by applying a generic element transition as follows:
FragmentManager fm = getChildFragmentManager(); Fragment fragment = ContentFragment.newInstance(); AutoTransition autoTransition = new AutoTransition(); autoTransition.setDuration(3000); fragment.setSharedElementEnterTransition(autoTransition); fm.beginTransaction() .replace(R.id.library, fragment) .addSharedElement(view, "cover") .commit();
It works great next to one: the initial position of the cover, when the animation starts in ContentFragment, is incorrect ( see this video from the video ) - it has an undesirable offset at the bottom.
Visually, this offset appears equal to the height of the HostFragment tab HostFragment . Do you guys know how to avoid this bias?
It is also worth noting that all RecyclerView's children have a unique transitionNames .
source share