Android活动转换-Window.excludeTarget()防止子视图的转换
我正在使用新的Android活动转换-Window.excludeTarget()防止子视图的转换,android,android-transitions,appbar,android-appbarlayout,Android,Android Transitions,Appbar,Android Appbarlayout,我正在使用新的转换Api,希望在两个活动之间实现一个良好的转换。这两个活动都包含一个带有选项卡的ViewPager的AppBar 当我第一次运行转换时,AppBar在两个活动转换之间淡出并再次进入,因此它看起来像是在闪烁: 为了解决这个问题,我试图通过调用transition.excludeTarget()从活动转换中排除AppBar: 此代码解决了闪烁问题,但引入了一个新问题:ViewPager选项卡不再有交叉淡入淡出动画: 这是两种布局在generell中的外观: <androi
转换Api
,希望在两个活动之间实现一个良好的转换。这两个活动都包含一个带有选项卡的ViewPager的AppBar
当我第一次运行转换时,AppBar
在两个活动转换之间淡出并再次进入,因此它看起来像是在闪烁:
为了解决这个问题,我试图通过调用transition.excludeTarget()
从活动转换中排除AppBar
:
此代码解决了闪烁问题,但引入了一个新问题:ViewPager选项卡不再有交叉淡入淡出动画:
这是两种布局在generell中的外观:
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
android:background="@color/toolbar_background"
>
<android.support.v7.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:titleTextColor="@color/toolbar_icons"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/Base.ThemeOverlay.AppCompat.Dark"
/>
<com.ogaclejapan.smarttablayout.SmartTabLayoutLight
android:layout_width="match_parent"
android:layout_height="48dp"
/>
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
/>
</android.support.design.widget.CoordinatorLayout>
是否有一种方法可以从过渡动画中排除视图/布局,但包括其子级?我试图通过调用transition.addTarget(MTAB)来添加ViewPager选项卡
代码>,但这没有什么区别。您应该只排除工具栏,而不是整个AppBarLayout
transition.excludeTarget(toolbar, true);
transition.excludeTarget(toolbar, true);