Change activity transition when inside a TabHost

前端 未结 2 332
南旧
南旧 2021-01-03 17:00

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

Unfortunately when I am on a TabActivity

相关标签:
2条回答
  • 2021-01-03 17:38

    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.

    0 讨论(0)
  • 2021-01-03 17:41

    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.

    0 讨论(0)
提交回复
热议问题