开发者

How do I set an Android View's transparency with animation?

I need to set the initial transparency for a TextView, but I don't know how to do it. On iPhone/iOS, it can be done easily with the alpha property. On Android, I've tried to set the alpha using AlphaAnimation but it's no good -- it doesn't work. It just returns to 100% alpha when the animation ends.

AlphaAnimatio开发者_运维技巧n anim = new AlphaAnimation(1, 0.2f);
anim.setDuration(5000);
textView.startAnimation(anim);

Any ideas guys?


You can set the alpha channel directly in a color value that you assign to the TextView. See Available Resource Types.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜