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.
精彩评论