1

I have a splash screen and other Activities.

The idea is that I want the splash screen to be full screen, and all the other Activities to have a title bar and an ActionBar, as usual.

I set 2 styles in the styles.xml file

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
</style>

<!-- Splash theme. -->
<style name="Splash" parent="@style/Theme.AppCompat.Light">
    <item name="windowNoTitle">true</item>
    <item name="windowActionBar">false</item>
    <item name="android:windowFullscreen">true</item>
    <item name="android:windowContentOverlay">@null</item>
</style>

Then in the manifest file I put

android:theme="@style/AppTheme"

After that, I'm lost: I tried to set the style &/or theme to use "Splash" for the splashScreen in xml code, but it didn't work

Setting the manifest style changes all the app Activities, and I want to change only one

Any help would be appreciated.

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Amr Yasser
  • 17
  • 10

2 Answers2

1

Change the activity theme, not the application theme.

<application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:fullBackupContent="false"
        android:label="@string/app_name"
        android:theme="@style/AppTheme"> <!-- Not here -->

    <activity 
        android:name=".SplashActivity"
        android:theme="@style/Splash" /> <!-- Change/add here -->

But note: parent="Theme.AppCompat.Light.NoActionBar" is the one you want if you want no Toolbar

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
0

You just need to make the style with toolbar the style of every single activity you want to have it.

For example in you manifest file you can fit the global style:

<application
    android:theme="@style/AppTheme">

And after that you must write in every activity the style that you want:

    <activity
        android:name=".SplashActivity"
        android:theme="@style/Splash">
    </activity>
dicarlomagnus
  • 576
  • 4
  • 17