Activity跳转共享元素(android5.0以上)
2016-01-28 11:39
288 查看
设置 ActivityA,ActivityB
重点:
1. xml要设置共享元素的特性 (ActivityA,ActivityB都要设置) android:transtionName=”XXX”,id可以变,但是transtionName一定要一致!
为兼容4.X:
PreLollipopTransition :
则:ActivityA: ActivityOptions options= ActivityOptions.makeSceneTransitionAnimation(this,btnContentAnim,"dalong2"); startActivity(new Intent(this,Activity2.class), options.toBundle()); ActivityB: oncreate(){ getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS); getWindow().setExitTransition(new Explode());//new Slide() new Fade() }
重点:
1. xml要设置共享元素的特性 (ActivityA,ActivityB都要设置) android:transtionName=”XXX”,id可以变,但是transtionName一定要一致!
ActivityA: <Button android:layout_width="match_parent" android:layout_height="50dp" android:layout_margin="10dp" android:text="Activity_共享动画" android:id="@+id/btn_content_trainanim" android:transitionName="dalong2" /> ActivityB: <Button android:layout_width="match_parent" android:layout_height="50dp" android:layout_margin="10dp" android:text="啊的身高多少个" android:id="@+id/btn_content_trainanim222222" android:transitionName="dalong2" />
为兼容4.X:
PreLollipopTransition :
项目主页:http://www.open-open.com/lib/view/home/1431671736904
相关文章推荐
- Android native反调试方式及使用IDA绕过反调试
- Android中的sp和wp指针
- 【转】NDK编译可执行文件在Android L中运行显示error: only position independent executables (PIE) are supported.失败问题解决办法。
- Android targetSdkVersion 原理 如何选择 compileSdkVersion, minSdkVersion 和 targetSdkVersion
- Android录音
- android studio奇淫巧计
- android ndk 入门笔记
- Android手机拍照或选取图库图片作为头像
- MVC框架模式在Android中的应用
- android完美实现 拍照 选择图片 剪裁等代码分享
- Android用canvas画哆啦A梦
- Android启动相机拍照并返回图片
- android图像绘制获取本地图片或拍照图片等图片资源
- 安卓内存泄露之context使用不当
- mac android studio clone github项目到本地.txt
- Android拍照保存在系统相册不显示的问题解决方法
- Android的ListView数据更新后,如何使最新的条目可以自动滚动到可视范围内
- Android 使用Gallery实现3D相册(附效果图+Demo源码)
- Android从系统Gallery获取图片具体实现
- 关于android和gradle的环境搭建