1

あるアクティビティから別のアクティビティに移動するときにアニメーションのようなページめくりを行うにはどうすればよいですか? 一部の ios アプリケーションではこれを見ましたが、android を検索すると、これに関するチュートリアルやコード スニペットが見つかりませんでした。

助けてください

4

3 に答える 3

2

はい、可能です。このチュートリアルを見てください。

2 つのアクティビティ間を遷移するときにアニメーションを追加する方法に関するチュートリアルを次に示します。ただし、この記事のように移動アニメーションを使用する代わりに、回転アニメーションを使用することをお勧めします。

于 2012-07-27T12:51:23.033 に答える
0

SDK のデモ コードは次のとおりです。

/**
 * <p>Example of using a custom animation when transitioning between activities.</p>
 */
public class Animation extends Activity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_animation);

        // Watch for button clicks.
        Button button = (Button)findViewById(R.id.fade_animation);
        button.setOnClickListener(mFadeListener);
        button = (Button)findViewById(R.id.zoom_animation);
        button.setOnClickListener(mZoomListener);
    }

    private OnClickListener mFadeListener = new OnClickListener() {
        public void onClick(View v) {
            // Request the next activity transition (here starting a new one).
            startActivity(new Intent(Animation.this, Controls1.class));
            // Supply a custom animation.  This one will just fade the new
            // activity on top.  Note that we need to also supply an animation
            // (here just doing nothing for the same amount of time) for the
            // old activity to prevent it from going away too soon.
            overridePendingTransition(R.anim.fade, R.anim.hold);
        }
    };

    private OnClickListener mZoomListener = new OnClickListener() {
        public void onClick(View v) {
            // Request the next activity transition (here starting a new one).
            startActivity(new Intent(Animation.this, Controls1.class));
            // This is a more complicated animation, involving transformations
            // on both this (exit) and the new (enter) activity.  Note how for
            // the duration of the animation we force the exiting activity
            // to be Z-ordered on top (even though it really isn't) to achieve
            // the effect we want.
            overridePendingTransition(R.anim.zoom_enter, R.anim.zoom_exit);
        }
    };
}

すべてのコードは apidemo/app/ にあります:)

于 2012-07-27T12:51:17.570 に答える
0

の反転アニメーションはActivityAndroid には存在しません..申し訳ありません!

于 2012-07-27T12:43:24.293 に答える