Follow

Advanced Usage - Customizing the Splash Screen

View original article on our GitHub

StartApp In-Ad provides two modes for displaying splash screens - Template and User-defined. The template splash screen is a pre-defined template in which you can place your own creatives, such as application name, logo and loading animation, as described below. If you want to use your own splash screen, you can provide it as a layout, using the user-defined mode.

Customizing the Template Splash Screen

In the OnCreate method of your Activity, after calling StartAppAd.init and before setContentView, call the following static function:

StartAppAd.showSplash(this, savedInstanceState, splashConfig);

Apply the following parameters:

  • this: The context (Activity)
  • savedInstanceState: The Bundle parameter passed to your onCreate(Bundle savedInstanceState) method.
  • splashConfig: Optional object that can be used to customize some of your template's properties to suit your needs, such as your application name, logo and theme (see the example below). For a full description of the SplashConfig API, please refer to SplashConfig API.

Example: the following is an example of a custom template with an OCEAN theme, modified application name, logo and landscape orientation:

StartAppAd.showSplash(this, savedInstanceState, 
          new SplashConfig()
                 .setTheme(SplashConfig.Theme.OCEAN)
                 .setAppName("Your Application Name")  
                 .setLogo(R.drawable.your_360x360_logo)   // resource ID
                 .setOrientation(SplashConfig.Orientation.LANDSCAPE)
);

NOTE: for optimal appearance of your Splash screen on all device densities, provide a logo of 360x360px and place it in the drawable folder of your project. If this folder does not exist, then create it.


If you do not provide a logo, then StartApp In-App uses the default application icon (as declared in the Manifest) and stretches it to 360x360px.

Adding a User-Defined Splash Screen

Use the following option if you already have a Splash screen for your application or if you want to design your own custom layout for your Splash screen.

1 Set a SplashConfig object with a specific layout resource ID.

2 Pass on the SplashConfig object to the showSplash static function.

For a full description of the SplashConfig API, please refer to SplashConfig API.

Example

StartAppAd.showSplash(this, savedInstanceState, 
     new SplashConfig()
            .setTheme(SplashConfig.Theme.USER_DEFINED)
            .setCustomScreen(R.layout.your_splash_screen_layout_id)
);

Back to top

SplashConfig API

The following describes the methods that you can use for customizing the Splash screen displayed in a StartApp In-App Splash screen Ad.

► Set the Splash screen mode

public SplashConfig setTheme(SplashConfig.Theme theme)

Sets the Splash theme to Template mode or User-defined mode. Use one of the first five options below to specify a design theme for the Template mode. The last option sets the mode to User-Defined. You may refer to Customizing the Splash Screen for more information about Splash screen modes.

Parameters
SplashConfig.Theme.DEEP_BLUE (default)
SplashConfig.Theme.SKY
SplashConfig.Theme.ASHEN_SKY
SplashConfig.Theme.BLAZE
SplashConfig.Theme.GLOOMY
SplashConfig.Theme.OCEAN
SplashConfig.Theme.USER_DEFINED – user-defined mode

► Set a Custom screen

public SplashConfig setCustomScreen(int resource)

Sets the splash layout to Custom mode. This is mandatory if you are using SplashConfig.Theme.USER_DEFINED.

Parameters
Layout Resource ID

► Set the application name

public SplashConfig setAppName(String appName)

Sets the application name to be used in the Template mode.

Parameters
String (default is the application name from the manifest).

► Set the logo

public SplashConfig setLogo(int resource)

Sets the logo to be displayed in the Template mode.

Parameters
Drawable resource ID (default is the icon resource from the manifest).

► Set the orientation

public SplashConfig setOrientation(SplashConfig.Orientation orientation)

Sets the orientation to be used in the Template or User-defined mode.

Parameters
SplashConfig.Orientation.PORTRAIT (default)
SplashConfig.Orientation.LANDSCAPE
SplashConfig.Orientation.AUTO (use the device's orientation upon entering the application)

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments