Android5.0以上共享元素动画及水波纹动画快速配置
2017-08-03 11:36
381 查看
一、Android5.0以上版本的共享元素的配置。
1、在格式配置文件中配置style属性。
2、在manifest配置文件中给Activity配置所使用到的主题。
3、多个界面的共享元素的名称要统一,并进行配置。
4、在界面完成跳转的过程中配置共享元素的相关属性并开始进行界面的跳转。
二、水波纹效果之–触摸反馈
1、编辑rippleDrawable配置文件,在drawable目录下。
2、在布局文件xml文件中使用该属性。
三、水波纹–Reveal effect(揭示效果)
1、在格式配置文件中配置style属性。
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <!-- Customize your theme here. --> <item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorAccent">@color/colorAccent</item> </style> <style name="TransitionTheme" parent="AppTheme"> <item name="android:windowContentTransitions">true</item> </style>
2、在manifest配置文件中给Activity配置所使用到的主题。
<activity android:name=".ActivityTest1" android:theme="@style/TransitionTheme"> <intent-filter> <action android:name="com.huaxinzhi.testnewanimation.intent.action.ActivityTest1" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </activity>
3、多个界面的共享元素的名称要统一,并进行配置。
android:transitionName="shareElement"
4、在界面完成跳转的过程中配置共享元素的相关属性并开始进行界面的跳转。
Intent intent = new Intent(ActivityTest1.this , AcitivityTest1Detail.class); Bundle options = ActivityOptionsCompat.makeSceneTransitionAnimation(ActivityTest1.this,view,"shareElement").toBundle(); ActivityCompat.startActivity(ActivityTest1.this,intent,options);
二、水波纹效果之–触摸反馈
1、编辑rippleDrawable配置文件,在drawable目录下。
<ripple android:color="@color/red" xmlns:android="http://schemas.android.com/apk/res/android"> <item> <shape> <solid android:color="@color/black"/> </shape> </item> </ripple>
2、在布局文件xml文件中使用该属性。
<Button android:background="@drawable/ripple_drawable" android:id="@+id/circle_one" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:textColor="@android:color/white" android:text="有边界"/>
<Button android:background="?Android:attr/selectableItemBackground" android:id="@+id/circle_one" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:textColor="@android:color/white" android:text="有边界"/> <Button android:background="?android:attr/selectableItemBackgroundBorderless" android:colorControlHighlight="@color/red" android:id="@+id/circle_two" android:layout_weight="1" android:layout_width="0dp" android:layout_height="match_parent" android:textColor="@android:color/white" android:text="无边界"/>
三、水波纹–Reveal effect(揭示效果)
Animator animator; if (repeat){ animator = ViewAnimationUtils .createCircularReveal(v,v.getWidth()/2,v.getHeight()/2,v.getWidth(),0); }else { animator = ViewAnimationUtils .createCircularReveal(v,v.getWidth()/2,v.getHeight()/2,0,v.getWidth()); } repeat = !repeat; animator.setInterpolator(new DecelerateInterpolator()); animator.setDuration(1500); animator.start();
相关文章推荐
- Android中Activity切换时共享视图元素的切换动画(5.0以上)
- Activity跳转共享元素(android5.0以上)
- Android动画共享元素(例列表图片放大到详情图片动画)
- 仿微信朋友圈实现共享视图元素的切换动画
- Linux下的文件共享全攻略系列之一:Samba服务器简介与快速配置指南 推荐
- 共享动画的实现(AndroidL及以上)
- Android中Activity切换时共享视图元素的切换动画(4.x兼容方案)
- 在Fragment如何使用共享元素转场动画
- android开发游记:通过xml配置快速实现点击热点效果和渐变动画(不用java代码)
- Android共享元素场景切换动画的实现
- 使用android5.0以上系统中隐藏的动画类进行手势识别的属性动画
- SharedElement共享元素动画效果
- Android5.0 共享元素 实现不同页面的同一个View的切换效果
- 为Android5.0及以上版本中的TextView等控件设置波纹效果
- Unity3D 使用DoTween配置界面元素动画
- Android中Activity切换时共享视图元素的切换动画(4.x兼容方案)
- 共享元素动画与Transition
- 自定义共享元素动画(imageView)
- 深入理解Android L新特性之 页面内容&共享元素过渡动画
- Android使用共享元素实现转场动画 错误:Unable to create layer for LinearLayout