title: Android's activity enter transitions won't work as intended on overlapping views
body: <p>Here is the scenario:</p>
  
  <p>I'm trying to declare transition animation between two activities - master and detail. Master is a <code>RecyclerView</code> list with images, detail is <code>LinearLayout</code> with header image from parent's list. Transitions are declared in XML and bound to detail activity like so:</p>
  
  <pre><code>&lt;item name="android:windowSharedElementEnterTransition"&gt;@transition/activity_enter_shared&lt;/item&gt;
  &lt;item name="android:windowEnterTransition"&gt;@transition/activity_enter&lt;/item&gt;
  </code></pre>
  
  <p>In <code>RecyclerView</code>'s adapter transition is triggered like so:</p>
  
  <pre><code>final ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(
      mContext, 
      imgView, 
      ViewCompat.getTransitionName(imgView)
  );
  mContext.startActivity(new Intent(mContext, ChildActivity.class), options.toBundle());
  </code></pre>
  
  <p>The problem is:
  In <code>@transition/activity_enter</code> I'm applying <code>fade</code> on some layout elements (e.g. back button). Those elements are placed in <code>FrameLayout</code> <strong>over an image</strong>. This seems to cause problems with <code>fade</code> views, which instead of smoothly appearing on the screen, "pop in". <strong>This only happens</strong> when views are overlapping - if placed in <code>LinearLayout</code> everythings works as intended.</p>
  
  <p><code>fade</code> is declared in <code>@transition/activity_enter</code> like so:</p>
  
  <pre><code>&lt;fade
      android:startDelay="300"
      android:duration="100"
      android:interpolator="@android:interpolator/linear"&gt;
      &lt;targets&gt;
          &lt;target android:targetId="@id/target_id" /&gt;
      &lt;/targets&gt;
  &lt;/fade&gt;
  </code></pre>
  
  <p><strong>Note 1</strong> - If triggered programmatically in <code>Activity</code> <code>fade</code> works fine:</p>
  
  <pre><code>final ViewGroup frame = (ViewGroup) findViewById(R.id.frame);
  frame.setOnClickListener(new View.OnClickListener() {
      boolean visible;
  
      @Override
      public void onClick(View v) {
          TransitionManager.beginDelayedTransition(frame);
          visible = !visible;
          frame.findViewById(R.id.target_id).setVisibility(visible ? View.VISIBLE : View.GONE);
      }
  });
  </code></pre>
  
  <p><strong>Note 2</strong> - Shared transition (<code>@transition/activity_enter_shared</code>) is custom, however, using default one doesn't solve the problem.</p>
  
  <p><strong>Note 3</strong> - In its simplest, layouts looks like this:</p>
  
  <pre><code>&lt;FrameLayout&gt;
      &lt;ImageView /&gt;
      &lt;ImageButton android:id="@+id/target_id" /&gt;
  &lt;/FrameLayout/&gt;
  </code></pre>
  
  <p>however, problem is not specific to <code>FrameLayout</code> but rather overlapping of views.</p>
  
  <p><strong>Note 4</strong> - For example, in the following layout <em>Lorem</em> will pop in, while  <em>ipsum</em> will fade in.</p>
  
  <p><a href="https://i.stack.imgur.com/JCW2a.png" rel="noreferrer"><img src="https://i.stack.imgur.com/JCW2a.png" alt="enter image description here"></a></p>