有人能告诉我如何在Pager片段中隐藏应用程序标题栏吗?
这应该足够了:
ActionBar bar = getActionBar(); // you might need to use getSupportActionBar() based on your project setup
bar.setDisplayShowTitleEnabled(false);
bar.setDisplayShowHomeEnabled(false);
Warren是正确的。如果你想在你的主题中隐藏它,你可以从一个不显示它的主题继承:
For pre-Honeycomb styles:
<style name="HiddenActionBar" parent="@android:style/Theme">
</style>
For Honeycomb+:
<style name="HiddenActionBar" parent="@android:style/Theme.Holo.NoActionBar">
</style>
我个人更喜欢这种方法,因为它使您的类摆脱了与 UI 相关的代码,并且可以通过在清单中更改应用程序的主题来轻松设置每个 Activity
。
setupActionbar(bar)
方法,并在需要时调用它。 - WarrenFaith