android 共享元素动画 抖动,Android使用共享元素实现转场动画 错误:Unable to create layer for XXXLayout...

java.lang.IllegalStateException: Unable to create layer for FrameLayout, size 720x20213 exceeds max size 8192

android:id="@+id/scroll_view"

android:layout_width="match_parent"

android:layout_height="0dp"

android:transitionGroup="true"

app:layout_constraintBottom_toTopOf="@+id/layout_shine"

app:layout_constraintEnd_toEndOf="parent"

app:layout_constraintStart_toStartOf="parent"

app:layout_constraintTop_toTopOf="parent">

android:layout_width="match_parent"

android:layout_height="match_parent">

android:id="@+id/img_bg"

android:layout_width="0dp"

android:layout_height="180dp"

android:scaleType="fitXY"

android:transitionName="@string/app_name"

app:layout_constraintEnd_toEndOf="parent"

app:layout_constraintStart_toStartOf="parent"

app:layout_constraintTop_toTopOf="parent" />

android:id="@+id/txt_date"

android:layout_width="0dp"

android:layout_height="wrap_content"

android:background="@color/white"

android:paddingStart="16dp"

android:paddingTop="14dp"

android:paddingEnd="16dp"

android:paddingBottom="14dp"

android:textColor="@color/font_color1"

android:textSize="16sp"

android:textStyle="bold"

app:layout_constraintEnd_toEndOf="parent"

app:layout_constraintStart_toStartOf="parent"

app:layout_constraintTop_toBottomOf="@+id/img_bg"

tools:text="苹果山药小米粥、山药豆腐蛋黄粥" />

android:id="@+id/layout_content"

android:layout_width="match_parent"

android:layout_height="match_parent"

android:layout_marginTop="8dp"

android:background="@color/white"

android:minHeight="300dp"

app:layout_constraintEnd_toEndOf="parent"

app:layout_constraintStart_toStartOf="parent"

app:layout_constraintTop_toBottomOf="@+id/txt_date">

android:id="@+id/web_view"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:layout_gravity="center"

android:gravity="center"

android:scrollbars="none"/>

在共享元素实现转场动画,Transition group 设置为true,让我们可以将ViewGroup作为一个整体来变换

最后的解决方案是,在最外边的ScrollView加上这一句话

android:transitionGroup="true"

问题 – A>ActivityOptionsCompat.makeSceneTransitionAnimation>B>onBackPressed()出错.

从Stackoverflow上得到的答案是:

The Fade transition will use hardware layers when your view does has “hasOverlappingRendering()” return true. This was done for performance. You must have many views all fading out separately.

You have a couple options. One is for your views to have hasOverlappingRendering return false. This may not be possible in all cases, but it may be enough to solve your problem. Remember that this means that the contained views should not overlap!

The second is to transition fewer views separately. You can do this by setting android:transitionGroup=“true” on ViewGroups that should be faded out together. For example, if you have a ListView with no background, you’ll end up transitioning each element separately. Instead, you can set the ListView’s transitionGroup property to true and then they’ll transition together.解决了.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值