Dive into Animate Spans with text and performance
summary
Line chooses APNG over GIF for full alpha and 24-bit color, then builds an open‑source APNG drawable library in C++/Kotlin that decodes assets and drives frame callbacks into TextView and EditText. Hardware rendering works for TextView; EditText forces software rendering with a limited canvas cache, so fixes include limit height or wrap in ScrollView, precompute text, and limit spans to 100–200 plus only letting the longest-duration animation call invalidate; implementation runs but needs those mitigations for acceptable performance.
AI-written summary · about
chapters (20)
- 0:00Intro
- 0:33Animation Emo
- 1:18Introduction
- 1:48APNG VS GIF
- 2:56What is APNG
- 3:35View Rendering
- 4:23Control hardware acceleration
- 4:51What is Span
- 5:35SpannableString
- 8:22Drawable.Callback
- 8:42Animate span inside TextView
- 10:55Problems with TextWatcher and isSelectable
- 12:10Solution for TextWatcher
- 12:49Cache issue with Software Rendering
- 13:18Animate span inside Edit Text
- 14:51Software Rendering with Edit Text
- 15:18Performance
- 15:37Number of Spans
- 16:57Rendering Methods
- 17:19Conclusion
related talks
23mThe lesser-known world of Spans
36mSpread your Wings with Spannables
42mAndroid Graphics: the Path to [UI] Riches
38mIn a World of Pure Android Animation 🍭🍫
37mAndroid Text, The Good The Bad and The ugly
37mThree Approaches to Animations on Android
35mBest practices for text on Android
47mLearn Some New Moves: Advanced Android Animation
