/**  
     * 定义从右侧进入的动画效果  
     * @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之极光推送发送自定义消息
  2. Android中一直走马灯效果的TextView
  3. DialogFragment设置自定义动画
  4. Android Recyclerview设置条目属性动画
  5. android折叠展开自定义列表项测试
  6. Android属性动画(ObjectAnimation)
  7. 自定义Tab选项卡

随机推荐

  1. 用Eclipse开发第一个Android应用程序Hell
  2. 值得学习的博客内容
  3. Caused by: java.lang.IllegalStateExcep
  4. 2013.09.02——— android 处理音频焦点
  5. android中layout_gravity 和 gravity的区
  6. 浙大网新-开启安卓开发高薪时代
  7. android studio单元测试
  8. Android(安卓)呼吸灯流程分析(一)
  9. Android(安卓)requires compiler complia
  10. Android中设置控件透明度的方法