开发者

Refreshing the Action Bar in Android 3.0

开发者 https://www.devze.com 2023-03-18 22:28 出处:网络
I am trying to implement an action bar within an activity. Is it possible to \"refresh\" or re-inflate the action bar with a new me开发者_如何学Gonu(without restarting the activity)

I am trying to implement an action bar within an activity. Is it possible to "refresh" or re-inflate the action bar with a new me开发者_如何学Gonu(without restarting the activity) The only way I have found so far is to leave the action bar empty and assign it a new customView every time I want it changed.


Try calling invalidateOptionsMenu() on your activity. Quoting the documentation:

Declare that the options menu has changed, so should be recreated. The onCreateOptionsMenu(Menu) method will be called the next time it needs to be displayed.

0

精彩评论

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

关注公众号