5

Can anyone tell how to hide the app title bar in Pager fragment. enter image description here

Android Pager

Nemo
  • 1,059
  • 3
  • 14
  • 31

2 Answers2

13

This should be enough:

ActionBar bar = getActionBar(); // you might need to use getSupportActionBar() based on your project setup
bar.setDisplayShowTitleEnabled(false);
bar.setDisplayShowHomeEnabled(false);
WarrenFaith
  • 57,492
  • 25
  • 134
  • 150
  • Thanks a lot :) Is there any way where i can set this from customized theme ? – Nemo Jan 18 '13 at 16:48
  • 1
    Not sure about that but I think using a base activity where all the others extending from is the best idea. You could also make a static `setupActionbar(bar)` method in a helper class and call it wherever you need it. – WarrenFaith Jan 18 '13 at 16:51
3

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.

andr
  • 15,970
  • 10
  • 45
  • 59