开发者

How to animate Activities of ActivityGroup

开发者 https://www.devze.com 2023-03-02 22:47 出处:网络
I am using an ActivityGroup and want a slide_in_up transition while new activity is started. I am currently using overridePendingTransition(...) method but it has no effect on animation.

I am using an ActivityGroup and want a slide_in_up transition while new activity is started. I am currently using overridePendingTransition(...) method but it has no effect on animation.

Here is the snippet which I am using to launch the new Activity.

View view = MainGroup.group.getLocalActivityManager().startActivity(NewsFeedScreen.TAG, intent  
    .addFlags(Inten开发者_如何学Ct.FLAG_ACTIVITY_CLEAR_TOP))
    .getDecorView();  

    MainGroup.group.replaceView(view, NewsFeedScreen.TAG);
    overridePendingTransition(R.anim.slide_in_up, 0);

here MainGroup is the ActivityGroup and NewsFeedScreen is the Activity I want to start with slide_in_up transition.

I have searched a lot but didn't find any solution. If anyone has a solution of similar sort of problem guys please help. thanks


I use a ViewAnimator for this. Here is a part of my solution:

final Window window = mLocalActivityManager.startActivity(pId, pIntent);
final View view = window != null ? window.getDecorView() : null;
if (view != null) {
    mViewAnimator.setInAnimation(AnimationUtils.loadAnimation(this, R.anim.pull_right_in));
    mViewAnimator.setOutAnimation(AnimationUtils.loadAnimation(this, R.anim.push_left_out));
    mViewAnimator.addView(view);
    mViewAnimator.showNext();    
}

When I go back to a previous activity I use showPrevious() and afterwards remove the view.

0

精彩评论

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