overridePendingTransition在TabActivity里失效的解决办法
2013-06-03 17:53
316 查看
最近改版一个应用商店性质的应用,把UI界面改成TabHost+Viewpager组合,在最后一个Tab里要向其他的界面(Activity)跳转,发现跳转时原本正常的动画失效了,baidu了一下,有人说:设置-->显示-->允许所有动画,但是我手机的设置里面没有这个选项,况且之前是正常的,所以感觉问题不是出在这里,转投Google,终于在StackOverFlow上找到了答案。
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方法后,动画正常。
附上代码片段:
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方法后,动画正常。
附上代码片段:
//没动画的代码 @Override public void onClick(View v) { switch (v.getId()) { case R.id.rlUpdate: Intent intent = new Intent(v.getContext(), NeedUpdateActivity.class); startActivity(intent); overridePendingTransition(R.anim.push_left_in, R.anim.push_left_out); break; case ..... } } //正常动画的代码 public class MainActivity extends TabActivity { ..... @Override protected void onPause() { super.onPause(); overridePendingTransition(R.anim.push_left_in, R.anim.push_left_out); } } @Override public void onClick(View v) { switch (v.getId()) { case R.id.rlUpdate: Intent intent = new Intent(v.getContext(), NeedUpdateActivity.class); startActivity(intent); //overridePendingTransition(R.anim.push_left_in, R.anim.push_left_out); break; } }
相关文章推荐
- overridePendingTransition在TabActivity里使用会失效的解决办法
- Android Activity切换动画overridePendingTransition 笔记 . 解决切换无响应的方法
- Android overridePendingTransition 失效问题解决
- 解决overridePendingTransition失效的问题
- Android 自定义activity切换动画实现,overridePendingTransition的使用详解
- Android Activity切换动画overridePendingTransition 笔记 . 解决切换无响应的方法
- activity——overridePendingTransition
- 关于overridePendingTransition效果在1.6版本中会出现VerifyError的问题的解决
- Android Activity切换动画overridePendingTransition
- Android中使用overridePendingTransition实现Activity切换动画
- activity启动动画overridePendingTransition()使用
- JS调用Activity方法时,方法里的overridePendingTransition 不起作用
- Activity切换动画(overridePendingTransition)-翻页效果
- Android:Activity切换动画、overridePendingTransition、fragment动画
- Activity切换动画overridePendingTransition的使用
- Activity切换动画·overridePendingTransition
- fragment里面嵌套tab(tab里 3ff8 面有多个fragment),onActivityResult不执行解决办法
- Activity切换效果overridePendingTransition的使用
- PendingIntent.getActivity()启动不起来Activity的解决办法
- Activity overridePendingTransition 切换动画