カウントダウンしたいTextViewがあります(3 ... 2 ... 1 ...何かが起こります)。
もう少し興味深いものにするために、各数字を完全な不透明度から開始し、透明度にフェードアウトさせます。
これを行う簡単な方法はありますか?
カウントダウンしたいTextViewがあります(3 ... 2 ... 1 ...何かが起こります)。
もう少し興味深いものにするために、各数字を完全な不透明度から開始し、透明度にフェードアウトさせます。
これを行う簡単な方法はありますか?
次のようなことを試してください:
private void countDown(final TextView tv, final int count) {
if (count == 0) {
tv.setText(""); //Note: the TextView will be visible again here.
return;
}
tv.setText(String.valueOf(count));
AlphaAnimation animation = new AlphaAnimation(1.0f, 0.0f);
animation.setDuration(1000);
animation.setAnimationListener(new AnimationListener() {
public void onAnimationEnd(Animation anim) {
countDown(tv, count - 1);
}
... //implement the other two methods
});
tv.startAnimation(animation);
}
打ち込んだだけなので、そのままではコンパイルできないかもしれません。