更换动作条菜单图标与一个不确定的进度不确定、图标、进度、菜单

2023-09-12 21:49:29 作者:上学的心情比上坟还沉重

我想一个不确定的进度栏添加到蜂窝动作条,让用户随时presses刷新,刷新图标暂时变成一个不确定的进度条,直到任务完成。电子邮件应用程序已经做了这个,但我无法弄清楚如何。

I would like to add an indeterminate progress bar to the Honeycomb ActionBar, so that any time the user presses "Refresh", the refresh icon temporarily turns into an indeterminate progress bar, until the task completes. The Email app does this already, but I can't figure out how.

任何意见?

推荐答案

很难说究竟是如何的电子邮件应用程序做它,但你可能想保持简单,只需要调用的 的setIcon与一名ID StateDrawable XML文件,然后只用一个定时器改变状态。

Hard to tell exactly how the Email app does it, but you may want to stay simple and just call setIcon with the id of a StateDrawable XML file, and then just change the state using a Timer.