Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/231.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android共享元素转换,起始位置错误_Android_Android Animation_Android Transitions - Fatal编程技术网

Android共享元素转换,起始位置错误

Android共享元素转换,起始位置错误,android,android-animation,android-transitions,Android,Android Animation,Android Transitions,我有一个像下图一样的布局 其中橙色框架是一个HostFragment,构建方式如下: <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"

我有一个像下图一样的布局

其中橙色框架是一个
HostFragment
,构建方式如下:

<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>
除了一件事之外,它还可以正常工作:当动画在ContentFragment中开始时,封面平铺的初始位置是错误的()-它有不希望的底部偏移

从视觉上看,该偏移量与
HostFragment
选项卡栏的高度相等。你们知道如何避免这种抵消吗


同样值得一提的是,所有的
RecyclerView的
孩子都有独特的
转换名

我知道这个问题由来已久,但我一直在为类似的问题而斗争


最后,我所要做的就是将父视图xml中的android:clipChildren标志更改为false。

您是否尝试隔离该问题,以查看它是否是由协调布局引起的。?这是一个有缺陷的类,所以我会尝试在一个简单的
FrameLayout
parent中运行动画,看看这个问题是否仍然存在。@PaulBurke感谢您的关注。我对最新支持和设计库中的大量问题感到有点不安。所以我决定现在使用另一种动画。我需要一些时间冷静下来,然后我会尽量孤立这个问题。
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();