我有一个,我想倒计时(3 ...... 2 ...... 1 ......事情发生)。
I've got a TextView that I would like to count down (3...2...1...stuff happens).
要使它更有趣,我想每一位数字开始完全不透明,淡出透明度。
To make it a little more interesting, I want each digit to start at full opacity, and fade out to transparency.
是否有这样做的一个简单的方法?
Is there a simple way of doing this?
尝试是这样的:
private void countDown(final TextView tv, final count) {
if (count == 0) {
tv.setText(""); //Note: the TextView will be visible again here.
return;
}
tv.setText(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);
}
我刚才输入出来,所以它可能无法编译原样。
I just typed it out, so it might not compile as is.
上一篇:警告:尚未开始活动,其当前的任务已被带到前面已被、任务
下一篇:如何确定目标在Android的布局文件夹的1280×720分辨率WXGA720(如新Galaxy Nexus的)?如新、文件夹、布局、分辨率