4

I am currently trying to go full-screen during my splash-screen Activity. I am doing that with a style, which is set on the Activity like this:

style.xml

<style name="SplashTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="android:windowNoTitle">true</item>
    <item name="android:windowActionBar">false</item>
    <item name="android:windowFullscreen">true</item>
    <item name="android:windowContentOverlay">@null</item>
    <item name="android:windowBackground">@drawable/background_splash</item>
</style>

AndroidManifest.xml

<activity
    android:name=".Activities.SplashScreenActivity"
    android:noHistory="true"
    android:screenOrientation="portrait"
    android:theme="@style/SplashTheme">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>

You might suggest doing that programmatically, but I already tried all the answers from this, this, this, this, this and this link. Currently, none of the programmatic solutions work for me - put every suggested fix in either onResume or onCreate of my splashActivity.java, but the status and navigation bar were still visible. However, when using my custom style it hides only the status bar, the navigation bar stays visible. What I've tried so far in the xml files: used different parents of the style, used no background drawable, removed screenOrientation and noHistory from activity. I am pretty sure I'm missing something here, but I can't see what. Can share more code if needed. Thanks in advance!

Noterezeck
  • 422
  • 4
  • 17
  • Is your SplashActivity extend from `AppCompatActivity` ? – SamyB Jun 26 '18 at 15:05
  • Yes, it's extending AppCompatActivity: `public class SplashScreenActivity extends AppCompatActivity` – Noterezeck Jun 26 '18 at 15:06
  • Just to test, can you add this style to your application node in Manifest.xml: – SamyB Jun 26 '18 at 15:08
  • I get a build error `Attribute application@theme value=(@style/MyMaterialTheme) from AndroidManifest.xml:33:9-43 is also present at AndroidManifest.xml:33:9-43 value=(@style/SplashTheme).` – Noterezeck Jun 26 '18 at 15:15
  • Are you defining `android:theme` two times in your application node? Can you share your manifest.xml please? – SamyB Jun 26 '18 at 15:16
  • I'm defining my application theme once, but some of my activities have different themes. – Noterezeck Jun 26 '18 at 15:18
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/173829/discussion-between-samyb-and-noterezeck). – SamyB Jun 26 '18 at 15:18

1 Answers1

1

Here my SplashScreenActivity style:

<style name="SplashTheme" parent="Theme.AppCompat.NoActionBar">
    <item name="android:windowBackground">@drawable/splash_logo_drawable</item>
</style>

I only use the attribute windowBackground

SamyB
  • 235
  • 1
  • 9