开发者

Modify options menu while it is visible before API 11

开发者 https://www.devze.com 2023-02-16 03:22 出处:网络
My options menu contains a \"refresh\" button that triggers an AsyncTask. I would like to have that button disabled while the task is running.

My options menu contains a "refresh" button that triggers an AsyncTask. I would like to have that button disabled while the task is running.

Can I modify an options menu even while it is visible, and if so, how?

Or can I at least force it to refresh and call onPrepareOptionsMenu() again?

Note: I am on API 开发者_如何学Golevel 8, so I cannot call invalidateOptionsMenu().


This is not possible in deprecated paradigm of android menus.

But you can migrate to new "actionBar" paradigm. While native ActionBar class is available only from API level 11, you still can use ActionBarSherlock library, which is backported to API level 4

0

精彩评论

暂无评论...
验证码 换一张
取 消