如何让textview闪烁
伙计们,我有一个文本视图,我需要它闪烁,请帮助我。
<TextView
android:id="@+id/usage"
android:layout_marginTop="220dip"
android:layout_marginLeft="45dip"
android:layout_marginRight="15dip"
android:typeface="serif"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Google "
android:textColor="#030900"/>
我希望谷歌文本闪烁
Guys i have a textview which i need it to be blinking please help me with it.
<TextView
android:id="@+id/usage"
android:layout_marginTop="220dip"
android:layout_marginLeft="45dip"
android:layout_marginRight="15dip"
android:typeface="serif"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Google "
android:textColor="#030900"/>
I want the google text to be blinking
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(10)
这是我使用 alpha 动画的帮助器实现:
Here is my helper implementation using an alpha animation:
您可以使用这个:
这与我在这篇文章中给出的答案相同 Blinking Text in android view< /a>
You can use this:
It's the same answer I gave in this post Blinking Text in android view
为此目的使用 XML 动画:
R.anim.blink
Blink Activity:像这样使用它:-
如果您有任何疑问,请告诉我。
Use XML Animations for this purpose :
R.anim.blink
Blink Activity: use it like this :-
Let me know if you have any queries..
已编辑
这是对
3.0
honeycomb版本之前的Android的已弃用答案,请使用SolArabehety的回答或查看此线程。我保留这个答案的唯一原因是在android 3.0之前的历史原因Android动画有很多问题,这个“糟糕”的解决方案在当时有效,现在使用它是不可想象的,所以就去吧对于动画解决方案,请勿使用此代码。
原答案
Edited
It is a deprecated answer to Android before version
3.0
honeycomb, please uses SolArabehety's answer or look at this thread.The only reason I keep this answer is to historical reasons before android 3.0 Android animations had a lot of problems, this "bad" solution work at that time, nowadays it is unthinkable to use it, so just go for an animation solution, don't use this code.
Original Answer
不需要为此设置。只是 alpha:
anim/flash_leave_now.xml
在代码中:
Don't need set for this. Just alpha:
anim/flash_leave_now.xml
And in code:
创建一个 AlphaAnimation 并将其应用到活动中的文本视图您设置文本视图的位置。闪烁可以通过重复从 1.0 alpha 到 0.0 alpha 到 1.0 alpha 的动画来完成。
编辑:Google 提供。
Create an AlphaAnimation and apply it to the textview in the activity where you setup the textview. The blinking would be accomplished by repeating an animation from 1.0 alpha to 0.0 alpha to 1.0 alpha.
Edit: Google provideth.
只需使用
标签即可。
Just use the
<blink/>
tag.感谢最上面的答案,这就是我所做的:
然后在代码的某个地方:
这将产生 5 秒的闪烁效果。如果您不想要淡入淡出效果,建议使用。
Courtesy to the top answer, this is what i did:
then somewhere on the code:
This will do a blink effect for 5 seconds. Recommended for if you don't want the fadeIn-fadeOut effect.