本文摘自 https://github.com/jaychou2012/SwitchLayout
看了作者的文章感觉挺好,于是写了这篇笔记 以备日后之需。
这里有15中进出动画
首先你要跳转的avtivity实现 SwichLayoutInterFace 接口
下面实现两个方法
@Override public void setEnterSwichLayout() { switch (key) { case 0: SwitchLayout.get3DRotateFromLeft(this, false, null); // 三个参数分别为(Activity/View,是否关闭Activity,特效(可为空)) break; case 1: SwitchLayout.getSlideFromBottom(this, false, BaseEffects.getMoreSlowEffect()); break; case 2: SwitchLayout.getSlideFromTop(this, false, BaseEffects.getReScrollEffect()); break; case 3: SwitchLayout.getSlideFromLeft(this, false, BaseEffects.getLinearInterEffect()); break; case 4: SwitchLayout.getSlideFromRight(this, false, null); break; case 5: SwitchLayout.getFadingIn(this); break; case 6: SwitchLayout.ScaleBig(this, false, null); break; case 7: SwitchLayout.FlipUpDown(this, false, BaseEffects.getQuickToSlowEffect()); break; case 8: SwitchLayout.ScaleBigLeftTop(this, false, null); break; case 9: SwitchLayout.getShakeMode(this, false, null,1); break; case 10: SwitchLayout.RotateLeftCenterIn(this, false, null); break; case 11: SwitchLayout.RotateLeftTopIn(this, false, null); break; case 12: SwitchLayout.RotateCenterIn(this, false, null); break; case 13: SwitchLayout.ScaleToBigHorizontalIn(this, false, null); break; case 14: SwitchLayout.ScaleToBigVerticalIn(this, false, null); break; default: break; } } @Override public void setExitSwichLayout() { switch (key) { case 0: SwitchLayout.get3DRotateFromRight(this, true, null); break; case 1: SwitchLayout.getSlideToBottom(this, true, BaseEffects.getMoreSlowEffect()); break; case 2: SwitchLayout.getSlideToTop(this, true, BaseEffects.getReScrollEffect()); break; case 3: SwitchLayout.getSlideToLeft(this, true, BaseEffects.getLinearInterEffect()); break; case 4: SwitchLayout.getSlideToRight(this, true, null); break; case 5: SwitchLayout.getFadingOut(this, true); break; case 6: SwitchLayout.ScaleSmall(this, true, null); break; case 7: SwitchLayout.FlipUpDown(this, true, BaseEffects.getQuickToSlowEffect()); break; case 8: SwitchLayout.ScaleSmallLeftTop(this, true, null); break; case 9: SwitchLayout.getShakeMode(this, true, null,1); break; case 10: SwitchLayout.RotateLeftCenterOut(this, true, null); break; case 11: SwitchLayout.RotateLeftTopOut(this, true, null); break; case 12: SwitchLayout.RotateCenterOut(this, true, null); break; case 13: SwitchLayout.ScaleToBigHorizontalOut(this, true, null); break; case 14: SwitchLayout.ScaleToBigVerticalOut(this, true, null); break; default: break; } }
具体用法详见 https://github.com/jaychou2012/SwitchLayout
allprojects {
repositories {
...
maven { url 'https://www.jitpack.io' }
}
}
compile 'com.github.jaychou2012:SwitchLayout:1.0.0.0'
本文的作者写的已经很清楚了欢迎前去star