私は一度に1つのアニメーションを表示するために5-6スレッドを使用しています。私は翻訳アニメーションとフレームアニメーションを使用しています。これは良いアイデアですか?それを行う最善の方法は何ですか?私のコードは以下のとおりです。アニメーションで5-6スレッドを使用することをお勧めしますか?
Handler handler1 = new Handler();
handler1.postDelayed(new Runnable() {
public void run() {
Animation animation = new TranslateAnimation(0 ,0 ,0 ,100);
animation.setDuration(800);
ImageView rimg2 = (ImageView) findViewById(R.id.rainfall);
animation.setRepeatCount(-1);
rimg2.startAnimation(animation);
Animation animation1 = new TranslateAnimation(-290, 290,0, -150);
animation1.setDuration(35000);
ImageView rimg = (ImageView) findViewById(R.id.cloud1);
rimg.setVisibility(View.VISIBLE);
animation1.setRepeatCount(-1);
rimg.startAnimation(animation1);
}
},0);
Handler handler2 = new Handler();
handler2.postDelayed(new Runnable() {
public void run() {
Animation animation = new TranslateAnimation(0 ,0 ,0 ,100);
animation.setDuration(800);
ImageView rimg3 = (ImageView) findViewById(R.id.drops);
animation.setRepeatCount(-1);
rimg3.startAnimation(animation);
rimg3.setVisibility(View.VISIBLE);
}
},1000);
Handler handler3 = new Handler();
handler3.postDelayed(new Runnable() {
public void run() {
Animation animation = new TranslateAnimation(0 ,0 ,-250 ,10);
animation.setDuration(800);
ImageView rimg2 = (ImageView) findViewById(R.id.rainfall1);
animation.setRepeatCount(-1);
rimg2.startAnimation(animation);
rimg2.setVisibility(View.VISIBLE);
}
},5000);
Handler handler4 = new Handler();
handler4.postDelayed(new Runnable() {
public void run() {
Animation animation = new TranslateAnimation(0 ,0 ,-150 ,10);
animation.setDuration(800);
ImageView rimg3 = (ImageView) findViewById(R.id.drops1);
animation.setRepeatCount(-1);
rimg3.startAnimation(animation);
rimg3.setVisibility(View.VISIBLE);
}
},10000);
Handler handler5 = new Handler();
handler5.postDelayed(new Runnable() {
public void run() {
Animation animation1 = new TranslateAnimation(-290, 290,0, -150);
animation1.setDuration(35000);
ImageView rimg = (ImageView) findViewById(R.id.cloud2);
rimg.setVisibility(View.VISIBLE);
animation1.setRepeatCount(-1);
rimg.startAnimation(animation1);
}
},15000);
申し訳ありませんと感謝を使用することができます。.. – yshak