为什么共享元素转换使透明活动空白?

时间:2016-04-22 17:59:09

标签: android android-animation android-styles android-transitions

我有一个包含片段的MainActivity,片段有一个FAB按钮,clicklistener为一个新的透明活动明星。
转换适用于配对视图,但当我使用ActivityCompat.startActivityForResult时,透明活动变为空白。

怎么了?

 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {

                ActivityOptionsCompat options = ActivityOptionsCompat.
                        makeSceneTransitionAnimation(activity, (View) fab, fab.getTransitionName());
                ActivityCompat.startActivityForResult(activity, intent, REQUEST, options.toBundle());
            }else{
                startActivityForResult(intent, REQUEST);
            }

我的风格res / values

<style name="AppTheme.BaseTranslucentParent" parent="Theme.AppCompat.NoActionBar">
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
        <item name="android:windowBackground">@android:color/transparent</item>
        <item name="android:textColorPrimary">@android:color/white</item>
        <item name="android:textViewStyle">@style/RobotoTextViewStyle</item>
        <item name="android:colorBackgroundCacheHint">@null</item>
        <item name="android:editTextStyle">@style/RobotoEditTextStyle</item>
        <item name="buttonStyle">@style/RobotoButtonStyle</item>
        <item name="android:windowIsTranslucent">true</item>
        <item name="android:windowAnimationStyle">@android:style/Animation</item>
        <item name="android:windowNoTitle">true</item>
    </style>

我的风格res / values-v21

<style name="AppTheme.BaseTranslucent" parent="AppTheme.BaseTranslucentParent">
        <item name="android:windowTranslucentStatus">true</item>
        <item name="android:windowActionBarOverlay">true</item>
        <item name="android:windowContentOverlay">@null</item>
        <item name="android:windowEnterTransition">@null</item>
        <item name="android:windowExitTransition">@null</item>
        <item name="android:windowContentTransitions">true</item>
        <item name="android:windowActivityTransitions">true</item>
        <item name="android:windowAllowEnterTransitionOverlap">true</item>
        <item name="android:windowAllowReturnTransitionOverlap">true</item>
    </style>

0 个答案:

没有答案