2

Я играю с новым Transition Api и хотел бы добиться приятного перехода между двумя действиями. Оба действия содержат AppBar с вкладкой ViewPager.Переходы на Android-активности - Window.excludeTarget() предотвращает переходы дочерних просмотров

Когда я был запущен при переходе первый раз, AppBar был утрачен, и снова между двумя переходами активности, так это выглядело, как это было моргание:

enter image description here enter image description here

Чтобы решить, что Я попытался исключить AppBar от перехода деятельности по телефону transition.excludeTarget():

// in onCreate() of the calling activity 
Transition transition = new Fade(); 
transition.excludeTarget(mAppBarLayout, true); 
getWindow().setExitTransition(transition); 
getWindow().setReenterTransition(transition); 

// in onCreate() of the called activity 
Transition transition = new Fade(); 
transition.excludeTarget(mAppBarLayout, true); 
getWindow().setEnterTransition(transition); 
getWindow().setReturnTransition(transition); 

Этот код решается мигающей проблема, но ввел новый: нет склейки анимации для ViewPager Tabs больше:

enter image description here

Это как обе раскладки выглядеть в 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> 

Есть ли способ исключить представление/макет из анимации перехода, но включить его детей? Я попытался добавить ViewPager Tabs, позвонив по телефону transition.addTarget(mTabs);, но это не повлияло.

ответ

0

Вы должны только исключить свою панель инструментов вместо всего AppBarLayout.

transition.excludeTarget(toolbar, true);