android - 棉花糖和奥利奥中的共享元素有不同的结果
问题描述
我想通过共享元素在聊天活动中制作一个浏览喜欢微信的图片的活动。但我发现了。使用相同的代码,动画在我的第一部手机(Android 6.0)中非常流畅。而在第二部手机(Android 8.0)中,动画有点不流畅。你有没有遇到过这样的情况?你知道原因吗?任何解决方案?
解决方案
我在我的演示中发现,如果你的活动如下
getWindow().setSharedElementEnterTransition(TransitionInflater.from(this).inflateTransition(R.transition.changebounds_with_test))
你的过渡如下
<?xml version="1.0" encoding="utf-8"?>
<transitionSet xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="500">
<changeBounds/>
<changeImageTransform/>
<changeClipBounds/>
<changeTransform/>
</transitionSet>
重点是持续时间大于 300 毫秒(默认持续时间)。那么Shared Element的动画在Oreo中就不流畅了。但是我没有在我的项目中设置 SharedElementEnterTransition,动画在 Oreo 中也很不流畅。我认为我的项目有任何影响动画的代码逻辑,这导致持续时间大于 300 毫秒。现在我不使用共享元素,而是使用值动画来制作过渡动画。
推荐阅读
- arduino - 如何在arduino中将字符串拆分为单词?
- java - 为什么if语句发送继续错误的while循环
- excel - 在 unix 中准确检查剪贴板的内容
- csv - %MACRO 将 CSV 文件导入 SAS
- c# - MySQL.Data 到 Pomelo - MysqlReader 更改
- google-sheets - 谷歌表格,基于公式的条件格式
- iis-8 - 使用 SSL 的 IIS ARR 负载平衡配置
- vue.js - Vuejs v-on:单击不适用于选项标签
- angular-material - Angular 5 自动完成:接受多个值
- mongodb - MongoDB mongoose $elemMatch 用于多个结果