2枚の画像を持ったスプラッシュスクリーンを作ろうとしています.1枚目が中央で上に移動し、2枚目が1枚目に完全に登場します。 私は第1の画像についてアニメーションを行ったが、第2の画像は所望の方法では動作していない。実際に私はimageswitcherやその他の機能を使っているのかどうかはわかりません。どうすればいいのか教えてください。 ここでコードを共有します。相対レイアウトで画像ビュー移動
public class Splash_screen extends Activity { // SPLASH ACTIVITY
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash_screen);
ImageView kfcpic = (ImageView) findViewById(R.id.kfclogo);
ImageView sogood= (ImageView)findViewById(R.id.sogood);
TranslateAnimation animation = new TranslateAnimation(0,0,0,-500); // new TranslateAnimation(xFrom,xTo, yFrom,yTo)
animation.setDuration(3000); // animation duration
//animation.setRepeatCount(0); // animation repeat count
animation.setRepeatMode(1);
animation.setFillAfter(true);
// repeat animation (left to right, right to left)
//animation.setFillAfter(true);
kfcpic.startAnimation(animation); // start animation
Thread logoTimer = new Thread() {
public void run() {
try {
sleep(5000);
runOnUiThread(new Runnable() {
public void run() {
Intent mainIntent = new Intent(Splash_screen.this, MainActivity.class);
startActivity(mainIntent);
}
});
} catch (InterruptedException e) {
e.printStackTrace();
} finally {
finish();
}
}
};
logoTimer.start();
}
}
2番目のイメージでは、アニメーションの開始オフセットを定義したり、アニメーションリスナーを終了アニメーションコールバックの最初のアニメーションに追加したりすることができます。あなたは今まで何を試しましたか? – Shaishav
@Override public void onAnimationEnd(アニメーションアニメーション){ sogood.startAnimation(animation2); } –
リスナーを追加しようとしましたが、最初の画像だけが動いて2番目は表示されません –