问题描述
I want to marquee text, and when the marquee completes (the 1 full marquee cycle), I want to trigger another event.有没有好的方法来做到这一点?选中文本视图时,我没有看到 OnEnd 或类似功能
I want to marquee text, and when the marquee completes (the 1 full marquee cycle), I want to trigger another event. Is there a good way to do this? I haven't seen an OnEnd or similar function when marquee-ing a textview
推荐答案
使用自定义的TextView
,你可以重写onDraw
来使用mMarquee的反射
code> 字段和 mMarquee
字段的 mStatus
字段(请参阅 grepcode 上的 TextView 代码等).
using a custom TextView
, you can override onDraw
to use reflection on mMarquee
field and on mStatus
field of the mMarquee
field (see TextView code on grepcode or such).
mStatus
运行时取值为 2,停止时取值为 0.
mStatus
value is 2 when marquee is running, and 0 when stopped.
onDraw
调用很多,但特别是在跑马灯完成后立即调用.
onDraw
is called a lot, but in particular, it is called right after the marquee is completed.
这篇关于选取框完成时触发事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!