Shared element transition - animate only the visible part of the shared view

五迷三道 提交于 2019-12-10 02:28:42

问题


I'm working in an app that is similar to Google Calendar...

  1. There are events and when a user click one, the event grows and transforms into the detail view.
  2. The shared views (the events) are inside a ScrollView, so at some point those views may be partially visible.
  3. The problem is that when one partially visible View is selected, the full View appears above all and then the animation runs.

Here is a capture of the problem:

What can I do to make the Transition take only the visible part of the View to animate it?

This is my transition:

<changeBounds xmlns:android="http://schemas.android.com/apk/res/android">
   <arcMotion android:minimumHorizontalAngle="15"
       android:minimumVerticalAngle="0"
       android:maximumAngle="90"/>
</changeBounds>

回答1:


Shared elements are drawn on top of the entire view hierarchy. You can disable this by setting Window#setSharedElementsUseOverlay(false) in your Activities, but this will result in undesired effects. More details here and on YouTube.

The better solution is to use shared elements transition between Fragments. More details here.



来源:https://stackoverflow.com/questions/48607863/shared-element-transition-animate-only-the-visible-part-of-the-shared-view

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!