2

Is it possible to disable the white flash which appears during Shared Element Transitions? I have a dark theme in my Android app, and the white flash makes the app unpleasant to use whenever there's a transition. While there were some questions regarding this issue, I couldn't solve this problem in my app so far.

(e.g. the cause for the blinking was in this stackoverflow question a NavigationDrawerLayout, but my transition gets started in my Activity after a view been clicked in a Fragment)

styles.xml

    <!-- enable window content transitions -->
    <item name="android:windowContentTransitions">true</item>
    <item name="android:windowAllowEnterTransitionOverlap">true</item>
    <item name="android:windowAllowReturnTransitionOverlap">true</item>

This method starts a new transition in my Activity

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void startItemDetailActivityTransition(Item pItem, boolean pForceComments, View pTransitionView) {
    Intent intent = new Intent(this,ItemDetailActivity.class);
    ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(this, Pair.create(pTransitionView, getString(R.string.transition_item)));
    intent.putExtra(ItemDetailActivity.EXTRA_ITEM, pItem);
    intent.putExtra(ItemDetailActivity.EXTRA_FORCE_COMMENTS, pForceComments);
    startActivity(intent, options.toBundle());
}

Thanks for the help

Community
  • 1
  • 1
user3135185
  • 913
  • 1
  • 7
  • 13

1 Answers1

0

try excluding the parts which have the white flash like this

        Fade fade = new Fade();
    fade.excludeTarget(R.id.p1,true);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        getWindow().setEnterTransition(fade);
    }
Nour abo elsoud
  • 967
  • 1
  • 9
  • 16