1

I am having problems trying to remove the Activity title text from my Action Bar Sherlock. I have spent(wasted) a lot of time trying to find a solution and just cannot make this work.

I have a Splash Activity on which I go full screen. But just before the Splash Activity appears, a screen appears (for a very short period of time) that has nothing but an Action Bar with the App Icon and Activity Title Text. I do not understand why it appears. Is this default Android behavior? I want to avoid this screen, or at least remove the Activity Title from the Action Bar on this screen. If I set it to "", I lose the app from the Recent Apps chooser.

Please refer to these images:

Pre Splash :

Splash Screen :

I have referred to the following examples on SO and also searched elsewhere. But nothing seems to work.

Remove the title text from the action bar in one single activity

Action Bar remove title and reclaim space

How do you remove the title text from the Android ActionBar?

How can I remove title and icon completetly in Actionbar sherlock?

Please check my Android Manifest and the theme file...

<application
    android:name="com.zipcash.zipcashbetaversion.MyApplication"
    android:allowBackup="true"
    android:icon="@drawable/zipcash_icon"
    android:label="@string/app_name"
    android:logo="@drawable/zipcash_logo_small"
    android:theme="@style/Theme.MyTheme" >
    <activity
        android:name="com.zipcash.zipcashbetaversion.SplashActivity"
        android:label="@string/app_name" 
        android:screenOrientation="portrait" >
        <intent-filter >
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity
        android:name="com.zipcash.zipcashbetaversion.SignUpActivity"
        android:label="@string/title_activity_sign_up"  
        android:screenOrientation="portrait" >
    </activity>

And so on... The following is my theme file:

<style name="Theme.MyTheme" parent="Theme.Sherlock.Light">

    <!-- Set style for Action Bar (affects tab bar too) -->
    <item name="actionBarStyle">@style/Widget.MyTheme.ActionBar</item>
</style>

<style name="Widget.MyTheme.ActionBar" parent="Widget.Sherlock.ActionBar">

    <!-- define background for action bar (sets default for all parts of action bar - main, stacked, split) -->
    <item name="android:background">@drawable/background</item>
    <item name="background">@drawable/background</item>

    <!-- set background for the tab bar (stacked action bar) - it overrides the background property -->
    <item name="backgroundStacked">@color/action_bar_tab_background</item>
    <item name="titleTextStyle">@style/NoTitleText</item>
    <item name="subtitleTextStyle">@style/NoTitleText</item>
    <item name="displayOptions">showHome|useLogo</item>
</style>

<style name="NoTitleText">
    <item name="android:textSize">0sp</item>
    <item name="android:textColor">#00000000</item>
    <item name="android:visibility">invisible</item>
</style>

I have also written this code in my Splash Activity:

    ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayOptions(actionBar.getDisplayOptions() ^ ActionBar.DISPLAY_SHOW_TITLE);
    actionBar.hide();

    ActivityHelper.initialize(this);

    setContentView(R.layout.activity_splash);

Have I made a mistake that I am overlooking. Is there something else I should do. My minimum API level is 8.

Any help will be appreciated.

Community
  • 1
  • 1
Bot
  • 622
  • 2
  • 10
  • 21

2 Answers2

3

You can add this to your activity:

android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" >
Mohammad Rababah
  • 1,730
  • 4
  • 17
  • 32
0

When you first launch your app and Application onCreate haven't finished loading you see the empty lag screen. You can set the window background to green and remove the ActionBar for Application theme, so it will look splash-like.

colors.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>

    <color name="splash_background">#86bf3a</color>

</resources>

styles.xml

<style android:name="SplashTheme" parent="@style/Theme.Sherlock.Light.NoActionBar">

    <item name="android:windowBackground">@color/splash_background</item>

</style>

Make application use splash theme with green background and no ActionBar

<application
    ...
    android:theme="@style/SplashTheme" >

    <activity
        android:name="com.zipcash.zipcashbetaversion.SplashActivity"
        ....>

        <!-- .... -->

    </activity>


        <!--...
             make all other Activities use MyTheme
        ...-->    


    <activity
        android:name="com.zipcash.zipcashbetaversion.SignUpActivity"
        ...
        android:theme="@style/Theme.MyTheme" />
Yaroslav Mytkalyk
  • 16,950
  • 10
  • 72
  • 99
  • The problem still persists. I tried a few tweaks too... The icon and the title are still there. – Bot May 05 '14 at 11:33
  • @Bot o yeah, I forgot that SplashActivity has to have SplashTheme too. Edited my answer. – Yaroslav Mytkalyk May 05 '14 at 15:03
  • I Tried it. It does not work. Can you tell me why that screen appears? And how can I avoid it altogether? – Bot May 06 '14 at 04:42
  • 1
    When showing first Activity, Application takes your application theme specified in manifest and shows Activity with that theme while Application itself starts loading. The Activity changes it theme when Application finished loading. There are similar questions for this http://stackoverflow.com/questions/23184333/how-to-set-the-theme-for-the-application-to-avoid-wrong-color-transitions – Yaroslav Mytkalyk May 08 '14 at 07:42