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
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
value is 2 when marquee is running, and 0 when stopped.
onDraw
is called a lot, but in particular, it is called right after the marquee is completed.
-
How can you get this mMarquee field? I have seen android.googlesource.com/platform/frameworks/base/+/… but I don't know how to get it work – Pablo R. Apr 15 '19 at 12:07
-
hi @njzk2. Can you share example on how to use reflection on getting mMarquee. I am having issue getting this field or inherited fields. Thanks – donmj Nov 27 '20 at 3:40
-
1@donmj see baeldung.com/java-reflection-class-fields to get started on reflection – njzk2 Nov 27 '20 at 7:59