1

I'm developing an android application and I cannot remove the title bar permanently. A solution posted here: How to hide the title bar for an Activity in XML with existing custom theme

(the 600 upvoted one, the others didn't work as described below) worked in general, but it maintained the title bar for a brief millisecond when initially launching the app.

I've tried various solutions throughout stackoverflow and other sites modifying the android theme in the manifest xml and style file(s). However, all of these solutions have all crashed the application before it began. The message in LogCat being that I must use an AppCompact theme. My main activity extends the ActionBarActivity class, and I have tried switching it to just Activity while also removing the :

if (savedInstanceState == null) {getSupportFragmentManager().beginTransaction()
            .add(R.id.container, new PlaceholderFragment()).commit();
        }

that is generated. However, when I do so, all of the views on the main activity disappear and it becomes completely white with nothing else. Is there a way to completely remove the actionbar while extending ActionBarActivity? If not, how can I switch to extending Activity or some other class while maintaining no other errors?

Community
  • 1
  • 1
  • 1
    http://stackoverflow.com/a/21434165/115145 -- create your own custom theme, inheriting from your chosen AppCompat base theme, where you apply `true`. – CommonsWare Aug 12 '14 at 22:20
  • You can check out this link: http://stackoverflow.com/questions/2591036/how-to-hide-the-title-bar-for-an-activity-in-xml-with-existing-custom-theme – Ali Aug 12 '14 at 22:24

2 Answers2

1

on styles.xml you should make that

parent="Theme.AppCompat.NoActionBar"

Sefa Teber
  • 11
  • 2
0

Do you use custom view for the ActionBar? if yes, then maybe you'll find the approach I use acceptable. I just set text color for Title and Subtitle the same as background color in my app's theme.

<style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">
    <item name="android:actionBarStyle">@style/ActionBar</item>
</style>

<style name="ActionBar" parent="@android:style/Widget.ActionBar">
    <item name="android:titleTextStyle">@style/ActionBar.Title</item>
    <item name="android:subtitleTextStyle">@style/ActionBar.Subtitle</item>
    <item name="android:background">@color/my_color</item>
    <item name="android:backgroundStacked">@color/my_color</item>
    <item name="android:backgroundSplit">@color/my_color</item>
</style>

<style name="ActionBar.Title">
    <item name="android:textColor">@color/my_color</item>
</style>

<style name="ActionBar.Subtitle">
    <item name="android:textColor">@color/my_color</item>
</style>

Then I inflate and apply custom ActionBar view in onCreate and set custom title

Alexander Zhak
  • 9,140
  • 4
  • 46
  • 72