1. Action bar 内容
- app icon
- view control
- action icon
- action overflow
2. Split Action Bar :一行action bar放不下时 在activity的manifest 文件中定义
uiOptions="splitActionBarWhenNarrow"可以吧top bar和main action bar合并。
- main action bar
- top bar
- bottom bar
3. Contextual Action Bar : 临时的action bar,覆盖在action bar上。
A contextual action bar (CAB) is a temporary action bar that overlays the app's action bar for theduration of a particular sub-task. CABs are most typically used for tasks that involve acting onselected data or text.
4. Action bar和 theme 有关。Theme.Holo
及子theme都支持除了 Theme.Holo
.NoActionBar
5. Action bar的添加和action处理同option menu
6. Action bar function 1: Help application navigation
- 在actionbar中
setDisplayHomeAsUpEnabled(true)
定义activity之间的父子关系
- 在manifest中定义,为严格的tree关系
- 在activity中
getSupportParentActivityIntent()
andonCreateSupportNavigateUpTaskStack()
和segment中onSupportNavigateUp()
7. 定义view control
在menuitem中增加属性
android:actionViewClass ,压缩view为icon adding8. 定义action provider:控制所有的action并可以显示子菜单"collapseActionView"
to theshowAsAction
侦听action view的扩展和压缩OnActionExpandListener()
android:actionProviderClass
A menu item selection is processed in the following order:不
- Receiving a call to
MenuItem.OnMenuItemClickListener.onMenuItemClick
. - Receiving a call to
onOptionsItemSelected(android.view.MenuItem)
FragmentActivity.onOptionsItemSelected(MenuItem)} - Receiving a call to
onOptionsItemSelected(android.view.MenuItem)
Fragment.onOptionsItemSelected(MenuItem)} - Launching the
Intent
set viaMenuItem.setIntent(android.content.Intent)
- Invoking this method.
在actionbar中可增加tab,每个tab都可被tablistener支持。在listener中将tab和segment相关联
10. 可以使用style来给actionbar定义不同的风格