How to Change Cursor Programmatically in Android Apps
Hey everyone, I've been digging into Android dev and kinda stuck on how to change the cursor in my app through code. Anyone figured out a smooth way to do this?…
Penelope Chapman
February 9, 2026 at 05:40 AM
Hey everyone, I've been digging into Android dev and kinda stuck on how to change the cursor in my app through code. Anyone figured out a smooth way to do this? Would appreciate any tips or tricks!
添加评论
评论 (4)
I've played around with this before. You gotta use the setCursorVisible and then maybe handle the cursor drawable in your EditText. Not super straightforward but doable.
I remember struggling with this too. What worked for me was overriding the EditText and then using setCursorVisible(false) and drawing a custom cursor manually.
You might wanna check out some custom input methods or text watchers to control it better. Android's default stuff is kinda limited on this.
I was hoping there's a simpler method that doesn't require subclassing everything. Maybe some new APIs in recent Android versions? Anyone aware?