3

It's a known bug in ActionBarSherlock when you use ActionBar with tabs + FragmentPagerAdapter and each fragment has its own options menu. After the configuration change the whole ActionBar becomes unresponsive. I use ABS 4.0.2 and Android 2.3.3. The bug is still present. Anybody knows how to bypass it?

4

1 回答 1

-1

Android 的默认 ActionBar 效果最好。

您可以拥有选项卡+选项卡的不同片段+每个选项卡的不同选项菜单,只需简单修改

onPrepareOptionsMenu(Menu menu)

和使用

invalidateOptionsMenu()

但是,为了补偿方向更改,您需要保存和加载选项卡的状态。为此,您将需要修改

onSaveInstanceState(Bundle outState)
onCreate(Bundle savedInstanceState)

您可以通过以下方式控制 Fragments 行为

onResume()
于 2012-08-17T10:49:25.727 回答