zoukankan      html  css  js  c++  java
  • overridePendingTransition在TabActivity里失效的解决办法

    I found out that the problem was because my view was a sub-activity inside a tab.
    To correctly override the transitions I've overridden the onPause method on the TabActivity and it now works as expected.
    翻译过来的意思大概是:

    我发现这个问题是因为我的View是一个Tab里面的子Activity。我在继承了TabActivity的子类Activity中重写OnPause方法后,动画正常。

    1. //没动画的代码  
    2. @Override  
    3. public void onClick(View v) {  
    4.     switch (v.getId()) {  
    5.     case R.id.rlUpdate:  
    6.         Intent intent = new Intent(v.getContext(), NeedUpdateActivity.class);  
    7.         startActivity(intent);  
    8.         overridePendingTransition(R.anim.push_left_in, R.anim.push_left_out);  
    9.         break;  
    10.     case .....  
    11.     }  
    12. }  
    13. //正常动画的代码  
    14. public class MainActivity extends TabActivity {  
    15.     .....  
    16.     @Override  
    17.     protected void onPause() {  
    18.         super.onPause();  
    19.         overridePendingTransition(R.anim.push_left_in, R.anim.push_left_out);  
    20.     }  
    21. }  
  • 相关阅读:
    Struts之上传
    Struts之准备工作
    前端--关于背景、浮动和定位
    javascript学习目录
    audio和video元素
    js实现动态操作table
    jquery全选、反选、全不选
    js实现页面跳转
    10 个非常有用的 AngularJS 框架
    JavaScript 语言基础知识点总结(思维导图)
  • 原文地址:https://www.cnblogs.com/xBig/p/5731746.html
Copyright © 2011-2022 走看看