Hiding app title bar in Android pager

孤人 提交于 2019-12-07 05:24:00

问题


Can anyone tell how to hide the app title bar in Pager fragment.


回答1:


This should be enough:

ActionBar bar = getActionBar(); // you might need to use getSupportActionBar() based on your project setup
bar.setDisplayShowTitleEnabled(false);
bar.setDisplayShowHomeEnabled(false);



回答2:


Warren is correct. And if you want to hide it in your theme, you can do it by inheriting from a theme that does not display it:

  • For pre-Honeycomb styles:

    <style name="HiddenActionBar" parent="@android:style/Theme">
    </style>
    
  • For Honeycomb+:

    <style name="HiddenActionBar" parent="@android:style/Theme.Holo.NoActionBar">
    </style>
    

I personally prefer this method because it frees your classes from UI-related code and can easily be set for every Activity by changing the theme of your application in the manifest.



来源:https://stackoverflow.com/questions/14403488/hiding-app-title-bar-in-android-pager

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