Contextual Action Bar in Honeycomb

蹲街弑〆低调 提交于 2019-12-12 10:48:36

问题


I'd like to change my Action Bar buttons in code according to whatever is selected on screen.

This is kind of like the Honeycomb Gmail app, where you can check a few mail items and get a different Action Bar with a different look too.

Any idea how I can do this?


回答1:


To obtain an action bar item, use the getActionBar() method within an activity. Once you have the ActionBar item, you can add and remove tabs using methods from within the ActionBar class.

The setCustomView() and setDisplayOptions() items will help tailor the action bar to a look more to your liking.

To add items to the action bar, you need to add them to the options menu. The action bar corresponds directly to the old menu (onCreateOptionsMenu() menu) of versions below 3.0. Take a look here.



来源:https://stackoverflow.com/questions/5984413/contextual-action-bar-in-honeycomb

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!