I have noticed that some Buttons don't seem as responsive as they could be. This applies equally to my app and to most other apps I've tried.
When I press a Button there is a tiny bit of lag (EDIT: I would estimate about 20-50 ms) before the Button lights up in the pressed state. Some apps have managed to remove this bit of lag, for instance RealCalc (available in the Market) whose Buttons switch to the pressed state immediately after you press your finger on them.
Most of the time this lag is not noticeable, but in my case where the Buttons are used in a custom number pad, this tiny bit of lag is disruptive to the user. RealCalc feels so much more responsive and polished because this lag has been removed.
My question is - how do I remove this lag? I am aware that I could just subclass, override onTouchEvent and proceed from there, but I would really prefer a solution using just the standard controls and options. I suspect the solution may also interfere with scrolling, but I can live with that.
EDIT: Specifically, the lag mentioned is the time from you put your finger on a button and hold it there until the button switches to the pressed state. The onClick handler is called when you remove your finger again.
Some answers suggested moving the bulk of my onClick handler to a thread. This is not the issue. To make doubly sure, I have removed all click handlers, and the tiny lag is still there.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…