Change activity transition when inside a TabHost

爷,独闯天下 提交于 2019-11-30 16:32:27

I had a similar problem with calling overridePendingTransition() from within a Fragment, because Fragments do not have overridePendingTransition() method defined.

I solved it using:

getActivity().overridePendingTransition(R.anim.enterAnim, R.anim.exitAnim);

Hope it helps. The Fragment was within a TabHost.

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.

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!