Here is the implementation I came across, hopefully reusing it:
Progressbutton
At the moment, when the user clicks the button, it displays pushed (and animations) for you, but you will have to cancel the loading animation manually as soon as you finish with the background task with:
_progressButton.stopLoadingAnimation();
This will reject any animation for you and display any previous text that was there. The only thing missing is that there is no text during the animation, but I think you can hack something together for this. I plan to expand this a bit further so that it allows you to call something like _progressButton.setProgress(10) , and then set the percentage to be executed. I can even make it thread safe.
Thus, you do not need to use multiple layouts and embed any text images on top of the buttons, and they will all be processed for you.
Sun
source share