在我的安卓应用中,我有一个启动页面,它会闪烁应用的标志三秒钟,然后开始登录活动。
以下是我的代码:
imgView.postDelayed(new Runnable() {
@Override
public void run() {
final Animation animation = new AlphaAnimation(1, 0);
animation.setDuration(1000);
animation.setInterpolator(new LinearInterpolator());
animation.setRepeatCount(Animation.INFINITE);
animation.setRepeatMode(Animation.REVERSE);
imgView.startAnimation(animation);
}
}, 3000);
Intent intent = new Intent(SplashscreenActivity.this,LoginActivity.class);
startActivity(intent);
但是图片一直在闪烁。如何在3秒后停止闪烁?我参考了一些帖子,但没有得到确切的答案。
setRepeatCount(Animation.INFINITE)
这一行代码上。请查看 Animation.setRepeatCount 的描述。 - AL.BlinkerView
可以解决问题 - 可以看看我的答案:https://dev59.com/iuo6XIcBkEYKwwoYIAcL#50299715 - 唯一需要注意的是要自己停止闪烁。你可以通过向处理程序发送消息来实现,就像其他人建议的那样。 - milosmns