更改活动过渡TabHost内部时, [英] Change activity transition when inside a TabHost

查看:132
本文介绍了更改活动过渡TabHost内部时,的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经用成功地改变活动之间的转换 overridePendingTransition()

I have successfully changed the transitions between activities using overridePendingTransition().

不幸的是,当我在 TabActivity 和使用的每个选项卡内的活动。当选项卡里面的内容的活动之一,启动另一个活动时, overridePendingTransition()似乎不起作用。

Unfortunately when I am on a TabActivity and use activities inside each tab. When one of those activities inside the content of the tab, starts another activity, the overridePendingTransition() seems to not work.

我基本上有一个 TabActivity ,里面居住了的ListView 的活动。该项目被点击时,我启动了项目的详细信息的活动我正在做的是。

I basically have a TabActivity, inside it resides an activity with a ListView. What I'm doing is when the item is clicked, I launch the item details' activity.

这个新的活动的过渡动画不被用覆盖了 overridePendingTransition()

This new activity's transition animation is not being overridden with the overridePendingTransition()

我基本上做到这一点:

private Activity owner;
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    Intent programActivity = new Intent().setClass(view.getContext(), ProgramActivity.class);
    Program program = (Program) parent.getItemAtPosition(position);
    programActivity.putExtra("programID", program.getId());
    owner.startActivity(programActivity);
    owner.overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
}

所以,我相信,我试图超越他们之后挂起的过渡被覆盖。

So, I believe that the pending transition is overridden after I'm trying to override them.

是否有不同的地方,我应该这样做吗? 我做了一些其他的低级错误?

Is there a different place I should do that? Am I doing some other stupid mistake?

谢谢!

推荐答案

我发现这个问题是因为我的观点是一个标签内的子活动。

I found out that the problem was because my view was a sub-activity inside a tab.

要正确地覆盖我已经覆盖了过渡的的onPause 的方法 TabActivity ,它现在按预期工作

To correctly override the transitions I've overridden the onPause method on the TabActivity and it now works as expected.

请注意:你仍然需要使用 overridePendingTransition()的监听器为您的项目,如果你的活动是不是一个标签中

Note: You still have to use the overridePendingTransition() on the listener for your items if your activity is NOT within a tab.

这篇关于更改活动过渡TabHost内部时,的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆