开发者

Activity Transition Animation not working from Tab Activity To any other Activity

I am trying to use activity transition animaition using OverridePendingTransition The same code works while I move from 1 activity to开发者_StackOverflow社区 another everywhere in my App But when I use the same while transitioning from an activity which is a part of tab to any other activity. The animation does not work and the standard animation takes place

        Intent intent = new Intent(xxx.this,
                yyy.class);

        startActivity(intent);
        overridePendingTransition(R.anim.slide_left_in, R.anim.slide_left_out);

here xxx is the class which is one of the tabs activity class and yyy is any activity class

I am stuck Any help would be appreciated

Thanks

Cheers Himanshu


I reported the same to google issues and the workaround provided was(I have not tried it though) :- I have found a way to work arround this, it is not perfect but it works. I add the overridePendingTransition(R.anim.slide_left_in, R.anim.slide_left_out); before the onPause on the TabActivity.

public void onPause() {
    overridePendingTransition(R.anim.slide_left_in, R.anim.slide_left_out);
    super.onPause()
}


Better way to make it work:

getTabHost().setOnTabChangedListener(new OnTabChangeListener() {
         public void onTabChanged(String tabId)
         {
                View selectedView = getTabHost().getCurrentView();
                if (getTabHost().getCurrentTab() > lastTab)
                {
                    selectedView .setAnimation( R.anim.slide_left_in );
                }
                else
                {
                    selectedView .setAnimation( R.anim.slide_left_out );
                }

                lastTab = getTabHost().getCurrentTab();
         }
    });
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜