/**  
     * 定义从右侧进入的动画效果  
     * @return  
     */  
    protected Animation inFromRightAnimation() {  
        Animation inFromRight = new TranslateAnimation(  
                Animation.RELATIVE_TO_PARENT, +1.0f,  
                Animation.RELATIVE_TO_PARENT, 0.0f,  
                Animation.RELATIVE_TO_PARENT, 0.0f,  
                Animation.RELATIVE_TO_PARENT, 0.0f);  
        inFromRight.setDuration(500);  
        inFromRight.setInterpolator(new AccelerateInterpolator());  
        return inFromRight;  
    }  

/**  

     * 定义从左侧进入的动画效果  
     * @return  
     */  
    protected Animation inFromLeftAnimation() {  
        Animation inFromLeft = new TranslateAnimation(  
                Animation.RELATIVE_TO_PARENT, -1.0f,  
                Animation.RELATIVE_TO_PARENT, 0.0f,  
                Animation.RELATIVE_TO_PARENT, 0.0f,  
                Animation.RELATIVE_TO_PARENT, 0.0f);  
        inFromLeft.setDuration(500);  
        inFromLeft.setInterpolator(new AccelerateInterpolator());  
        return inFromLeft;  
    }
    
    /**  
     * 定义从左侧退出的动画效果  
     * @return  
     */  
    protected Animation outToLeftAnimation() {  
        Animation outtoLeft = new TranslateAnimation(  
                Animation.RELATIVE_TO_PARENT, 0.0f,  
                Animation.RELATIVE_TO_PARENT, -1.0f,  
                Animation.RELATIVE_TO_PARENT, 0.0f,  
                Animation.RELATIVE_TO_PARENT, 0.0f);  
        outtoLeft.setDuration(500);  
        outtoLeft.setInterpolator(new AccelerateInterpolator());  
        return outtoLeft;  
    } 
    
    /**  
     * 定义从左侧进入的动画效果  
     * @return  
     */  
    protected Animation inFromLeftAnimation2() {  
        Animation inFromLeft = new TranslateAnimation(  
                Animation.RELATIVE_TO_SELF, 0.0f,  
                Animation.RELATIVE_TO_SELF, 0.7f,  
                Animation.RELATIVE_TO_SELF, 0.0f,  
                Animation.RELATIVE_TO_SELF, 0.0f);  
        inFromLeft.setDuration(500);  
        inFromLeft.setFillAfter(true);
        inFromLeft.setInterpolator(new AccelerateInterpolator());  
        return inFromLeft;  
    }
    
    /**  
     * 定义从左侧退出的动画效果  
     * @return  
     */  
    protected Animation outToLeftAnimation2() {  
        Animation outtoLeft = new TranslateAnimation(  
                Animation.RELATIVE_TO_SELF, 0.0f,  
                Animation.RELATIVE_TO_SELF, 0.0f,  
                Animation.RELATIVE_TO_SELF, 0.0f,  
                Animation.RELATIVE_TO_SELF, 0.0f);  
        outtoLeft.setDuration(500);  
        outtoLeft.setFillAfter(true);
        outtoLeft.setInterpolator(new AccelerateInterpolator());  
        return outtoLeft;  
    }

更多相关文章

  1. Android双向seekbar
  2. android 多项对话框
  3. Android(安卓)drawable 渐变色
  4. Android旋转动画
  5. Android自定义对话框(Dialog)位置,大小
  6. DialogFragment设置自定义动画
  7. Android(安卓)Recyclerview设置条目属性动画
  8. android上方显示进度的进度条
  9. Android(安卓)HFP Profile 连接过程

随机推荐

  1. AlertDialog
  2. android textview 利用空格实现文字均匀
  3. 解决 Android java.lang.RuntimeExceptio
  4. android屏幕监控上下左右滑动
  5. SQlite Android 数据库应用程序系统
  6. Android(安卓)BaseFragment封装
  7. android java复制和压缩文件或文件夹
  8. android典型代码系列(三十)------DES加密
  9. 初学Android的surfaceView
  10. android 自定义toggle Button按钮