Activity的进出动画学习笔记

本文摘自 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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值