Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
663 views
in Technique[技术] by (71.8m points)

custom activity transition animation in Android

The current flow of my app is Activity A -> Activity B ->Fragment B I am trying to implement Activity transition animation. I have read many posts on SO mentioning about using overridependingtransition() and I have implemented almost everything mentioned in these posts. Somehow the animation is not working.

I need this to work on Android 2.2 i.e. sdkversion 8

This is the code:

Activity A 
oncreate method

Intent detailIntent = new Intent(this, WordDetailActivity.class);
            detailIntent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
            detailIntent.putExtra(DbAdapter.KEY_ROWID, id);
                startActivity(detailIntent);
                overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);


 @Override
    protected void onPause() {
        super.onPause();
        overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
    }


Activity B

    @Override
    protected void onPause() {
        // TODO Auto-generated method stub
        super.onPause();
        overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
    }

It would be great if someone could also suggest me any alternative way to implement activity transitions upto android 2.2

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Phones that have their animation disabled in the phone settings wont show the activity transition animations... so don't count on it.

Also, you can't change these users settings.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...