あるアクティビティから別のアクティビティに移動するときにアニメーションのようなページめくりを行うにはどうすればよいですか? 一部の ios アプリケーションではこれを見ましたが、android を検索すると、これに関するチュートリアルやコード スニペットが見つかりませんでした。
助けてください
あるアクティビティから別のアクティビティに移動するときにアニメーションのようなページめくりを行うにはどうすればよいですか? 一部の ios アプリケーションではこれを見ましたが、android を検索すると、これに関するチュートリアルやコード スニペットが見つかりませんでした。
助けてください
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/ にあります:)
の反転アニメーションはActivity
Android には存在しません..申し訳ありません!