
AnimationSet animationSet1 = new AnimationSet(true); |
AnimationSet animationSet2 = new AnimationSet(true); |
imageView2.setVisibility(View.VISIBLE); |
TranslateAnimation ta = new TranslateAnimation( |
Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, |
-1f, Animation.RELATIVE_TO_SELF, 0f, |
Animation.RELATIVE_TO_SELF, 0f); |
ta.setDuration(15000); |
animationSet1.addAnimation(ta); |
animationSet1.setFillAfter(true);//停留在最后的位置 |
ta = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 1.0f, |
Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, |
0f, Animation.RELATIVE_TO_SELF, 0f); |
ta.setDuration(15000);//动画持续时间 |
animationSet2.addAnimation(ta); |
animationSet2.setFillAfter(true);//停留在最后的位置 |
imageView.startAnimation(animationSet1);//设置动画 |
imageView2.startAnimation(animationSet2); |
imageView.setBackgroundResource(images[count % 2]); |
count++; |
imageView2.setBackgroundResource(images[count % 2]); |
if (juage) |
handler.postDelayed(runnable, 15000); |
Log.i("handler", "handler"); |
} |



