Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
660 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 Answer

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...