【发布时间】:2014-07-08 20:40:30
【问题描述】:
我有 5 张图片,我希望 img1 和 img2 同时闪烁 3 秒,然后 img3 和 img4 同时闪烁 3 秒。但是,我希望 img5 保持静止 3 秒,然后整个过程重新开始。
我的部分代码:
public class MainActivity extends Activity
{
...
img1=(ImageView) findViewById(R.id.imageView1);
img2=(ImageView) findViewById(R.id.imageView2);
img3=(ImageView) findViewById(R.id.imageView3);
img4=(ImageView) findViewById(R.id.imageView4);
img5=(ImageView) findViewById(R.id.imageView5);
img2.setVisibility(View.GONE);
img3.setVisibility(View.GONE);
....
anim = new AlphaAnimation(0.0f, 1.0f);
anim.setDuration(500); //You can manage the time of the blink with this parameter
anim.setStartOffset(30);
anim.setRepeatMode(Animation.REVERSE);
anim.setRepeatCount(20);
...
img1.startAnimation(anim);
AnimationListener animListener = new AnimationListener()
{
@Override
public void onAnimationEnd(Animation arg0) {
// TODO Auto-generated method stub
img1.setVisibility(View.GONE);
img2.setVisibility(View.VISIBLE);
img2.startAnimation(anim2);
}
@Override
public void onAnimationRepeat(Animation animation) {
}
@Override
public void onAnimationStart(Animation animation) {
}
};
}
【问题讨论】:
-
img5 暂停,但 img1&2 img3&4 没有同时闪烁。仍然需要帮助来解决这个问题。