[Splash Screen]How to show an image in full screen?

The best way to show a full screen splash activity is by putting this line in your manifest under activity tag

android:theme="@android:style/Theme.Light.NoTitleBar.Fullscreen"

You can use other themes as well

Theme.Black.NoTitleBar.Fullscreen
Theme.NoTitleBar.Fullscreen

<activity
        android:name="com.example.SplashActivity"
        android:label="@string/app_name" 
        android:theme="@android:style/Theme.Light.NoTitleBar.Fullscreen">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

For Latest Api Lollipop and above

<style name="Theme.AppCompat.Light.NoActionBar.FullScreen" 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>

Define this theme for the splash activity and provide it in manifest

android:theme="@style/Theme.AppCompat.Light.NoActionBar.FullScreen"


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" 
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ImageView android:layout_width="fill_parent"
    android:layout_height="fill_parent" 
    android:src="@drawable/image" />
</LinearLayout>

and add the below code before setContentView(R.layout.splash_screen);

this.requestWindowFeature(Window.FEATURE_NO_TITLE);

Tags:

Android